From 8c4bac81e69dbc9ca0fdcb616b5342d9659c5eee Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sat, 14 Aug 2021 09:28:36 +0800 Subject: [PATCH] General fixes to table design, added state and district seeder for china, made changes to create order process, and ui and vue js components changes for registration, dashboard and registration --- .env.example | 2 + .../ControllersLogic/CreateCustomerLogic.php | 4 +- .../ControllersLogic/CreateCompanyLogic.php | 30 +- .../CompanyModuleObject.php | 80 +-- .../CreateCompanyModuleProcessor.php | 30 +- .../Services/CreatesCompanyModule.php | 12 +- .../UploadIdentityDocumentProcessor.php | 27 +- .../ControllersLogic/CreateOrderLogic.php | 6 - .../DataTransferObjects/OrderObject.php | 79 +-- .../DataTransferObjects/OrderRoleObject.php | 52 +- .../Processors/CreateOrderProcessor.php | 119 ++--- .../Processors/CreateOrderProcessorOld.php | 131 +++++ .../Processors/CreateOrderRoleProcessor.php | 61 --- .../Processors/CreateOrderRolesProcessor.php | 84 +++ .../Services/ChecksIfOrderNumberExists.php | 28 + .../Modules/Orders/Services/CreatesOrder.php | 12 +- .../Orders/Services/CreatesOrderRole.php | 15 +- .../Orders/Services/GeneratesOrderNumber.php | 31 ++ .../Orders/Standards/Rules/CanCreateOrder.php | 10 +- .../Standards/Validators/OrderValidation.php | 22 +- .../Modules/Unity/Services/CreatesEntity.php | 2 +- .../ValueObjects/Constants/BusinessType.php | 14 +- .../ValueObjects/Constants/OrderRoleTypes.php | 29 ++ .../Constants/WarehouseReferences.php | 18 + app/Http/Resources/OrderResource.php | 5 +- app/Models/Company.php | 42 +- app/Models/CompanyModule.php | 34 +- app/Models/Order.php | 13 +- app/Models/OrderRole.php | 17 + config/unity.php | 2 +- ...21_06_21_232944_create_addresses_table.php | 2 + ...23_152229_create_company_modules_table.php | 4 + .../2021_07_07_174510_create_orders_table.php | 5 +- ... 2021_07_07_174624_create_steps_table.php} | 17 +- ..._07_07_174640_create_order_roles_table.php | 7 +- ...7_21_110059_create_packing_lists_table.php | 1 + ...2021_07_22_145827_modify_company_table.php | 31 -- .../2021_08_02_224659_modify_order_roles.php | 32 -- .../2021_08_03_014833_modify_order_steps.php | 30 -- ...1_08_12_125207_alter_order_steps_table.php | 36 -- database/seeders/CompaniesTableSeeder.php | 138 +++-- database/seeders/DistrictsTableSeeder.php | 484 +++++++++++++++--- database/seeders/StatesTableSeeder.php | 41 +- .../forms/RegistrationFormComponent.vue | 140 +++-- .../orders/forms/OrderFormComponent.vue | 17 +- .../validation/registrationFormValidation.js | 10 +- 46 files changed, 1302 insertions(+), 704 deletions(-) create mode 100644 app/Classes/Modules/Orders/Processors/CreateOrderProcessorOld.php delete mode 100644 app/Classes/Modules/Orders/Processors/CreateOrderRoleProcessor.php create mode 100644 app/Classes/Modules/Orders/Processors/CreateOrderRolesProcessor.php create mode 100644 app/Classes/Modules/Orders/Services/ChecksIfOrderNumberExists.php create mode 100644 app/Classes/Modules/Orders/Services/GeneratesOrderNumber.php create mode 100644 app/Classes/ValueObjects/Constants/OrderRoleTypes.php create mode 100644 app/Classes/ValueObjects/Constants/WarehouseReferences.php rename database/migrations/{2021_07_07_174624_create_order_steps_table.php => 2021_07_07_174624_create_steps_table.php} (54%) delete mode 100644 database/migrations/2021_07_22_145827_modify_company_table.php delete mode 100644 database/migrations/2021_08_02_224659_modify_order_roles.php delete mode 100644 database/migrations/2021_08_03_014833_modify_order_steps.php delete mode 100644 database/migrations/2021_08_12_125207_alter_order_steps_table.php diff --git a/.env.example b/.env.example index 44853cd5..696b7171 100644 --- a/.env.example +++ b/.env.example @@ -49,3 +49,5 @@ PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +UNITY_APP_URL="https://unity.izyim.com" diff --git a/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php index 4961eead..92a1d088 100644 --- a/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php +++ b/app/Classes/Modules/Accounts/ControllersLogic/CreateCustomerLogic.php @@ -16,6 +16,7 @@ use App\Classes\Modules\Contacts\Processors\CreateContactProcessor; use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor; use App\Classes\ValueObjects\Constants\ApprovalStatus; +use App\Classes\ValueObjects\Constants\BusinessType; use App\Classes\ValueObjects\Constants\RoleTypes; use App\Models\Company; @@ -111,13 +112,12 @@ class CreateCustomerLogic extends AbstractControllerLogic $this->createContactProcessor->execute($request, $company); /** @var CompanyModule $companyModule */ - $companyModule = $this->createCompanyModuleProcessor->execute($company, $request->input('business_type')); + $companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::IMPORTER); $Object = new EmploymentObject($companyModule, $user); $this->assignEmployeeProcessor->execute($Object); - //$this->assignSegmentProcessor->execute($company); $this->uploadIdentityDocumentProcessor->execute($request, $company); diff --git a/app/Classes/Modules/Companies/ControllersLogic/CreateCompanyLogic.php b/app/Classes/Modules/Companies/ControllersLogic/CreateCompanyLogic.php index 55c7f574..24a1bcf2 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/CreateCompanyLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/CreateCompanyLogic.php @@ -9,24 +9,13 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\BusinessType; use App\Classes\ValueObjects\Constants\CompanyType; use App\Http\Resources\CompanyResource; +use App\Models\Company; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; class CreateCompanyLogic extends AbstractControllerLogic { - /** - * CreateCompanyLogic constructor. - * @param CreateCompanyProcessor $createCompanyProcessor - * @param CreateCompanyModuleProcessor $createCompanyModuleProcessor - */ - public function __construct(CreateCompanyProcessor $createCompanyProcessor ,CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateEntityProcessor $createUnityEntityProcessor) - { - $this->createCompanyProcessor = $createCompanyProcessor; - $this->createCompanyModuleProcessor = $createCompanyModuleProcessor; - $this->createUnityEntityProcessor = $createUnityEntityProcessor; - } - /** * @return array */ @@ -37,9 +26,23 @@ class CreateCompanyLogic extends AbstractControllerLogic ]; } - /** @var CreateCompanyProcessor */ + + /** @var CreateCompanyProcessor */ private $createCompanyProcessor; + /** @var CreateCompanyModuleProcessor */ + private $createCompanyModuleProcessor; + + /** + * CreateCompanyLogic constructor. + * @param CreateCompanyProcessor $createCompanyProcessor + * @param CreateCompanyModuleProcessor $createCompanyModuleProcessor + */ + public function __construct(CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor) + { + $this->createCompanyProcessor = $createCompanyProcessor; + $this->createCompanyModuleProcessor = $createCompanyModuleProcessor; + } /** * @param Request $request @@ -50,6 +53,7 @@ class CreateCompanyLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { + /** @var Company $company */ $company = $this->createCompanyProcessor->execute($request, $request->input('type'), ApprovalStatus::PENDING_SUBMISSION); $this->createCompanyModuleProcessor->execute($company , $request->input('business_type')); diff --git a/app/Classes/Modules/Companies/DataTransferObjects/CompanyModuleObject.php b/app/Classes/Modules/Companies/DataTransferObjects/CompanyModuleObject.php index da3619c6..e9d67319 100644 --- a/app/Classes/Modules/Companies/DataTransferObjects/CompanyModuleObject.php +++ b/app/Classes/Modules/Companies/DataTransferObjects/CompanyModuleObject.php @@ -6,14 +6,12 @@ use App\Classes\General\Interfaces\DataTransferObject; class CompanyModuleObject implements DataTransferObject { - /** @var int */ - private $companyId; - /** @var int|null */ - private $type; + /** @var string */ + private $name; - /** @var int|null */ - private $status; + /** @var string */ + private $reference; /** @var string */ private $unity_hash_id; @@ -21,27 +19,61 @@ class CompanyModuleObject implements DataTransferObject /** @var string */ private $unity_signature; + /** @var int */ + private $type; + + /** @var int */ + private $status; + /** - * CompanyObject constructor. - * @param int $companyId - * @param int|null $type - * @param int|null $status + * CompanyModuleObject constructor. + * @param string $name + * @param string $reference + * @param string $unity_hash_id + * @param string $unity_signature + * @param int $type + * @param int $status */ - public function __construct(int $companyId, int $type, int $status, ?string $unity_hash_id, ?string $unity_signature) + public function __construct(string $name, string $reference, string $unity_hash_id, string $unity_signature, int $type, int $status) { - $this->companyId = $companyId; - $this->type = $type; - $this->status = $status; + $this->name = $name; + $this->reference = $reference; $this->unity_hash_id = $unity_hash_id; $this->unity_signature = $unity_signature; + $this->type = $type; + $this->status = $status; } /** - * @return int + * @return string */ - public function getCompanyId(): int + public function getName(): string { - return $this->companyId; + return $this->name; + } + + /** + * @return string + */ + public function getReference(): string + { + return $this->reference; + } + + /** + * @return string + */ + public function getUnityHashId(): string + { + return $this->unity_hash_id; + } + + /** + * @return string + */ + public function getUnitySignature(): string + { + return $this->unity_signature; } /** @@ -60,19 +92,5 @@ class CompanyModuleObject implements DataTransferObject return $this->status; } - /** - * @return string - */ - public function getUnityHashId(): string - { - return $this->unity_hash_id; - } - /** - * @return string - */ - public function getUnitySignature(): string - { - return $this->unity_signature; - } } diff --git a/app/Classes/Modules/Companies/Processors/CreateCompanyModuleProcessor.php b/app/Classes/Modules/Companies/Processors/CreateCompanyModuleProcessor.php index cbd21942..6f50f44e 100644 --- a/app/Classes/Modules/Companies/Processors/CreateCompanyModuleProcessor.php +++ b/app/Classes/Modules/Companies/Processors/CreateCompanyModuleProcessor.php @@ -17,46 +17,54 @@ class CreateCompanyModuleProcessor /** @var CreatesCompanyModule */ private $createsCompanyModule; + /** @var CreateEntityProcessor */ private $createUnityEntityProcessor; + /** @var CanCreateCompanyModule */ private $canCreateCompanyModule; - private $createEntityProcessor; + /** @var CreateEntityProcessor*/ + private $createsEntityProcessor; + /** @var CreateEntitySignatureProcessor */ private $createUnityEntitySignatureProcessor; /** * CreateCompanyModuleProcessor constructor. * @param CreatesCompanyModule $createsCompanyModule + * @param CreateEntityProcessor $createUnityEntityProcessor + * @param CanCreateCompanyModule $canCreateCompanyModule + * @param CreateEntityProcessor $createsEntityProcessor + * @param CreateEntitySignatureProcessor $createUnityEntitySignatureProcessor */ - public function __construct(CanCreateCompanyModule $canCreateCompanyModule, CreatesCompanyModule $createsCompanyModule, CreateEntityProcessor $createUnityEntityProcessor, CreateEntitySignatureProcessor $createUnityEntitySignatureProcessor) + public function __construct(CreatesCompanyModule $createsCompanyModule, CreateEntityProcessor $createUnityEntityProcessor, CanCreateCompanyModule $canCreateCompanyModule, CreateEntityProcessor $createsEntityProcessor, CreateEntitySignatureProcessor $createUnityEntitySignatureProcessor) { $this->createsCompanyModule = $createsCompanyModule; $this->createUnityEntityProcessor = $createUnityEntityProcessor; $this->canCreateCompanyModule = $canCreateCompanyModule; + $this->createsEntityProcessor = $createsEntityProcessor; $this->createUnityEntitySignatureProcessor = $createUnityEntitySignatureProcessor; } + /** * @param Company $company + * @param int|null $businessType * @return Model + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException */ - public function execute(Company $company , ?int $businessType): Model + public function execute(Company $company , ?int $businessType = BusinessType::IMPORTER): Model { $unityEntity = $this->createUnityEntityProcessor->execute($company->name); $unityEntitySignature = $this->createUnityEntitySignatureProcessor->execute($unityEntity->hash_id); - $company_module_object = new CompanyModuleObject( - $company->id, - $businessType??BusinessType::IMPORTER, - $company->status, - $unityEntity->hash_id, - $unityEntitySignature->hash_id, - ); + $company_module_object = new CompanyModuleObject($company->name, $company->reference, $unityEntity->hash_id, $unityEntitySignature->hash_id, $businessType, $company->status); $this->canCreateCompanyModule->passes($company_module_object); - return $this->createsCompanyModule->execute($company_module_object); + return $this->createsCompanyModule->execute($company, $company_module_object); } } diff --git a/app/Classes/Modules/Companies/Services/CreatesCompanyModule.php b/app/Classes/Modules/Companies/Services/CreatesCompanyModule.php index fdcafb93..2082355e 100644 --- a/app/Classes/Modules/Companies/Services/CreatesCompanyModule.php +++ b/app/Classes/Modules/Companies/Services/CreatesCompanyModule.php @@ -3,26 +3,30 @@ namespace App\Classes\Modules\Companies\Services; use App\Classes\General\Eloquent\AbstractUpdateRecord; +use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord; use App\Classes\Modules\Companies\DataTransferObjects\CompanyModuleObject; +use App\Models\Company; use App\Models\CompanyModule; -class CreatesCompanyModule extends AbstractUpdateRecord +class CreatesCompanyModule extends AbstractUpdateRelationshipRecord { /** + * @param Company $company * @param CompanyModuleObject $object * @return \Illuminate\Database\Eloquent\Model * @throws \App\Classes\Exceptions\MalformedRequestException */ - public function execute(CompanyModuleObject $object) + public function execute(Company $company, CompanyModuleObject $object) { $model = new CompanyModule(); - $model->company_id = $object->getCompanyId(); + $model->name = $object->getName(); + $model->reference = $object->getReference(); $model->type = $object->getType(); $model->status = $object->getStatus(); $model->unity_hash_id = $object->getUnityHashId(); $model->unity_signature = $object->getUnitySignature(); - return $this->handler($model); + return $this->handler($company->companyModules(), $model); } } diff --git a/app/Classes/Modules/Documents/Processors/UploadIdentityDocumentProcessor.php b/app/Classes/Modules/Documents/Processors/UploadIdentityDocumentProcessor.php index 9fb09c4a..3d7978f5 100644 --- a/app/Classes/Modules/Documents/Processors/UploadIdentityDocumentProcessor.php +++ b/app/Classes/Modules/Documents/Processors/UploadIdentityDocumentProcessor.php @@ -9,30 +9,38 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\CompanyType; use App\Classes\ValueObjects\Constants\DocumentType; +use App\Models\Document; use Illuminate\Http\Request; use App\Models\Company; class UploadIdentityDocumentProcessor { + + /** @var CreatesDocument */ + private $createsDocument; + + /** @var CreatesFiles */ + private $createsFiles; + /** * UploadIdentityDocumentProcessor constructor. * @param CreatesDocument $createsDocument - * @param CreatesFiles $createsFile + * @param CreatesFiles $createsFiles */ - public function __construct(CreatesDocument $createsDocument, CreatesFiles $createsFile) + public function __construct(CreatesDocument $createsDocument, CreatesFiles $createsFiles) { $this->createsDocument = $createsDocument; - $this->createsFile = $createsFile; + $this->createsFiles = $createsFiles; } + /** - * @param DocumentObject $object - * @return Array - * @throws \App\Classes\Exceptions\AccessForbiddenException + * @param Request $request + * @param Company $company + * @return array * @throws \App\Classes\Exceptions\MalformedRequestException - * @throws \App\Classes\Exceptions\RequestValidationException */ - public function execute(Request $request, Company $company): Array { + public function execute(Request $request, Company $company): array { $object = new DocumentObject($company->type === CompanyType::COMPANY_BUSINESS ? DocumentType::SSM_REGISTRATION : DocumentType::IDENTITY_CARD, $request->input('files'), @@ -40,7 +48,8 @@ class UploadIdentityDocumentProcessor /** @var Document $document */ $document = $this->createsDocument->execute($company, $object); - return $this->createsFile->execute($document, $object); + + return $this->createsFiles->execute($document, $object); } } \ No newline at end of file diff --git a/app/Classes/Modules/Orders/ControllersLogic/CreateOrderLogic.php b/app/Classes/Modules/Orders/ControllersLogic/CreateOrderLogic.php index 42e625c2..c7262717 100644 --- a/app/Classes/Modules/Orders/ControllersLogic/CreateOrderLogic.php +++ b/app/Classes/Modules/Orders/ControllersLogic/CreateOrderLogic.php @@ -3,13 +3,7 @@ namespace App\Classes\Modules\Orders\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Orders\DataTransferObjects\OrderObject; -use App\Classes\Modules\Orders\Services\CreatesOrder; use App\Classes\Modules\Orders\Processors\CreateOrderProcessor; -use App\Classes\Modules\Orders\Standards\Rules\CanCreateOrder; -use App\Classes\ValueObjects\Constants\OrderStatus; -use App\Classes\ValueObjects\Constants\OrderSteps; -use App\Classes\ValueObjects\Constants\OrderType; use App\Http\Resources\OrderResource; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; diff --git a/app/Classes/Modules/Orders/DataTransferObjects/OrderObject.php b/app/Classes/Modules/Orders/DataTransferObjects/OrderObject.php index ac872509..d98ee7e6 100644 --- a/app/Classes/Modules/Orders/DataTransferObjects/OrderObject.php +++ b/app/Classes/Modules/Orders/DataTransferObjects/OrderObject.php @@ -4,93 +4,56 @@ namespace App\Classes\Modules\Orders\DataTransferObjects; use App\Classes\General\Interfaces\DataTransferObject; +use App\Classes\ValueObjects\Constants\ApprovalStatus; class OrderObject implements DataTransferObject { - private $id; - - private $company_module_id; + /** @var int */ private $reference; - private $reference_contract; - + /** @var int */ private $type; + /** @var int|null */ private $status; - private $current_step; - - private $address_id; - - private $warehouse_id; - - public function __construct(int $company_module_id, ?string $reference, string $reference_contract, int $type, int $status, string $current_step, int $id=0, int $address_id, int $warehouse_id) + /** + * OrderObject constructor. + * @param int $reference + * @param int $type + * @param int|null $status + */ + public function __construct(int $reference, int $type, ?int $status = ApprovalStatus::PENDING_VERIFICATION) { - $this->company_module_id = $company_module_id; $this->reference = $reference; - $this->reference_contract = $reference_contract; $this->type = $type; $this->status = $status; - $this->current_step = $current_step; - $this->id = $id; - $this->address_id = $address_id; - $this->warehouse_id = $warehouse_id; } - public function getId(): int - { - return $this->id; - } - - public function getCompanyModuleId(): int - { - return $this->company_module_id; - } - - public function getReference(): string + /** + * @return int + */ + public function getReference(): int { return $this->reference; } - public function getReferenceContract(): string - { - return $this->reference_contract; - } - + /** + * @return int + */ public function getType(): int { return $this->type; } + /** + * @return int + */ public function getStatus(): int { return $this->status; } - public function getCurrentStep(): string - { - return $this->current_step; - } - - public function getWarehouseId(): int - { - return $this->warehouse_id; - } - - public function getAddressId(): int - { - return $this->address_id; - } - - public function setCurrentStep(string $step) - { - $this->current_step = $step; - } - - public function setStatus(int $status) - { - $this->status = $status; - } } diff --git a/app/Classes/Modules/Orders/DataTransferObjects/OrderRoleObject.php b/app/Classes/Modules/Orders/DataTransferObjects/OrderRoleObject.php index d87fcda1..727591f4 100644 --- a/app/Classes/Modules/Orders/DataTransferObjects/OrderRoleObject.php +++ b/app/Classes/Modules/Orders/DataTransferObjects/OrderRoleObject.php @@ -4,43 +4,57 @@ namespace App\Classes\Modules\Orders\DataTransferObjects; use App\Classes\General\Interfaces\DataTransferObject; +use App\Models\CompanyModule; +use App\Models\Order; class OrderRoleObject implements DataTransferObject { - private $order_id; - private $company_module_id; + /** @var Order */ + private $order; - private $role_hash_id; + /** @var CompanyModule */ + private $companyModule; - private $role_signature; + /** @var int */ + private $role; - public function __construct(int $order_id, int $company_module_id, ?string $role_hash_id, ?string $role_signature) + /** + * OrderRoleObject constructor. + * @param Order $order + * @param CompanyModule $companyModule + * @param int $role + */ + public function __construct(Order $order, CompanyModule $companyModule, int $role) { - $this->order_id = $order_id; - $this->company_module_id = $company_module_id; - $this->role_hash_id = $role_hash_id; - $this->role_signature = $role_signature; + $this->order = $order; + $this->companyModule = $companyModule; + $this->role = $role; } - public function getOrderId(): int + /** + * @return Order + */ + public function getOrder(): Order { - return $this->order_id; + return $this->order; } - public function getCompanyModuleId(): int + /** + * @return CompanyModule + */ + public function getCompanyModule(): CompanyModule { - return $this->company_module_id; + return $this->companyModule; } - public function getRoleHashId(): ?string + /** + * @return int + */ + public function getRole(): int { - return $this->role_hash_id; + return $this->role; } - public function getRoleSignature(): ?string - { - return $this->role_signature; - } } diff --git a/app/Classes/Modules/Orders/Processors/CreateOrderProcessor.php b/app/Classes/Modules/Orders/Processors/CreateOrderProcessor.php index e472a5a2..4af95696 100644 --- a/app/Classes/Modules/Orders/Processors/CreateOrderProcessor.php +++ b/app/Classes/Modules/Orders/Processors/CreateOrderProcessor.php @@ -2,129 +2,92 @@ namespace App\Classes\Modules\Orders\Processors; +use App\Classes\General\Interfaces\Addressable; use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject; use App\Classes\Modules\Addresses\Services\CreatesAddress; use App\Classes\Modules\Addresses\Services\FetchesAddress; +use App\Classes\Modules\Companies\Services\FetchesCompany; use App\Classes\Modules\Orders\DataTransferObjects\OrderObject; use App\Classes\Modules\Orders\Services\CreatesOrder; +use App\Classes\Modules\Orders\Services\GeneratesOrderNumber; use App\Classes\Modules\Orders\Standards\Rules\CanCreateOrder; -use App\Classes\Modules\Orders\Processors\ConfirmOrderProcessor; -use App\Classes\Modules\OrderSteps\Processors\CreateOrderStepsProcessor; -use App\Classes\Modules\Unity\Services\CreatesContract; -use App\Classes\ValueObjects\Constants\OrderStatus; -use App\Classes\ValueObjects\Constants\OrderSteps; +use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\OrderType; -use App\Classes\Modules\Unity\Processors\CreateContractProcessor; -use App\Classes\Modules\Unity\Processors\ActivateContractProcessor; -use App\Classes\Modules\Unity\Processors\CreateContractEntityProcessor; -use App\Classes\Modules\Unity\Processors\AssignContractEntityProcessor; -use App\Classes\Modules\Orders\Processors\CreateOrderRoleProcessor; -use App\Classes\Modules\Addresses\Processors\CreateOrderAddressProcessor; +use App\Models\CompanyModule; +use App\Models\Order; use Illuminate\Http\Request; class CreateOrderProcessor { + + /** @var GeneratesOrderNumber */ + private $generatesOrderNumber; + /** @var CanCreateOrder */ private $canCreateOrder; /** @var CreatesOrder */ private $createsOrder; - /** @var ConfirmOrderProcessor */ - private $confirmOrderProcessor; - - /** @var CreateOrderStepsProcessor */ - private $createOrderStepsProcessor; - - /** @var CreatesContract */ - private $unityCreateContract; - - /** @var AssignContractEntityProcessor */ - private $unityAssignContractEntity; - - /** @var CreateContractEntityProcessor */ - private $unityCreateContractEntity; - - /** @var ActivateContractProcessor */ - private $unityActivateContract; - - /** @var CreateOrderRoleProcessor */ - private $createOrderRoleProcessor; + /** @var fetchesAddress */ + private $fetchesAddress; /** @var CreatesAddress */ private $createAddress; - /** @var FetchesAddress */ - private $fetchesAddress; + /** @var FetchesCompany */ + private $fetchesCompany; + + /** @var CreateOrderRolesProcessor */ + private $createOrderRolesProcessor; /** * CreateOrderProcessor constructor. + * @param GeneratesOrderNumber $generatesOrderNumber * @param CanCreateOrder $canCreateOrder * @param CreatesOrder $createsOrder - * @param \App\Classes\Modules\Orders\Processors\ConfirmOrderProcessor $confirmOrderProcessor - * @param CreateOrderStepsProcessor $createOrderStepsProcessor - * @param CreatesContract $unityCreateContract - * @param AssignContractEntityProcessor $unityAssignContractEntity - * @param CreateContractEntityProcessor $unityCreateContractEntity - * @param ActivateContractProcessor $unityActivateContract - * @param \App\Classes\Modules\Orders\Processors\CreateOrderRoleProcessor $createOrderRoleProcessor - * @param CreatesAddress $createAddress * @param FetchesAddress $fetchesAddress + * @param CreatesAddress $createAddress + * @param FetchesCompany $fetchesCompany + * @param CreateOrderRolesProcessor $createOrderRolesProcessor */ - public function __construct(CanCreateOrder $canCreateOrder, CreatesOrder $createsOrder, \App\Classes\Modules\Orders\Processors\ConfirmOrderProcessor $confirmOrderProcessor, CreateOrderStepsProcessor $createOrderStepsProcessor, CreatesContract $unityCreateContract, AssignContractEntityProcessor $unityAssignContractEntity, CreateContractEntityProcessor $unityCreateContractEntity, ActivateContractProcessor $unityActivateContract, \App\Classes\Modules\Orders\Processors\CreateOrderRoleProcessor $createOrderRoleProcessor, CreatesAddress $createAddress, FetchesAddress $fetchesAddress) + public function __construct(GeneratesOrderNumber $generatesOrderNumber, CanCreateOrder $canCreateOrder, CreatesOrder $createsOrder, FetchesAddress $fetchesAddress, CreatesAddress $createAddress, FetchesCompany $fetchesCompany, CreateOrderRolesProcessor $createOrderRolesProcessor) { + $this->generatesOrderNumber = $generatesOrderNumber; $this->canCreateOrder = $canCreateOrder; $this->createsOrder = $createsOrder; - $this->confirmOrderProcessor = $confirmOrderProcessor; - $this->createOrderStepsProcessor = $createOrderStepsProcessor; - $this->unityCreateContract = $unityCreateContract; - $this->unityAssignContractEntity = $unityAssignContractEntity; - $this->unityCreateContractEntity = $unityCreateContractEntity; - $this->unityActivateContract = $unityActivateContract; - $this->createOrderRoleProcessor = $createOrderRoleProcessor; - $this->createAddress = $createAddress; $this->fetchesAddress = $fetchesAddress; + $this->createAddress = $createAddress; + $this->fetchesCompany = $fetchesCompany; + $this->createOrderRolesProcessor = $createOrderRolesProcessor; } + /** + * @param Request $request + * @return Addressable + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ public function execute(Request $request){ - $reference_no = rand(1000000, 9999999); + /** @var CompanyModule $importer */ + $importer = $this->fetchesCompany->execute(['id' => $request->get('company_id')])->companyModules()->importers()->first(); - //Call Unity to create contract and get contract reference no (and all the obligations) - $contract = $this->unityCreateContract->execute(); - $contract_reference_no = $contract->hash_id; - $contract_obligation_list = $contract->contract_obligation_list; + $orderObject = new OrderObject($this->generatesOrderNumber->execute(), OrderType::SHARED_CONTAINER, $importer->status === ApprovalStatus::APPROVED ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION); - //Activate Contract (if not activated then cannot update status) - $activated = $this->unityActivateContract->execute($contract_reference_no); + $this->canCreateOrder->passes($orderObject); - //Create Order on Shipping Platform - $order_object = new OrderObject($request->get('company_module_id'), $reference_no, $contract_reference_no, OrderType::SHARED_CONTAINER, OrderStatus::PROCESSING, OrderSteps::PROCESSING, 0, $request->get('address_id'), $request->get('warehouse_id')); - $this->canCreateOrder->passes($order_object); - $order = $this->createsOrder->execute($order_object); - - $address = $this->fetchesAddress->execute(['id' => $order_object->getAddressId()]); + /** @var Order $order */ + $order = $this->createsOrder->execute($importer, $orderObject); + $address = $this->fetchesAddress->execute(['id' => $request->get('address_id')]); $addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode,$address->reference); - //Add address (polymorphic) $this->createAddress->execute($order, $addressObject); - //Add order roles - Allow entity to process this order - //This processor calls Unity to create Contract Entity ID - $orderRoles = $this->createOrderRoleProcessor->execute($request, $order->id, $contract_reference_no); - - //Call Unity to assign contract entity to obligation - $this->unityAssignContractEntity->execute($request, $orderRoles, $contract_obligation_list); - - //Add processing to order step - //Note: For processing apointee_id is CIEF Freight Forward , id is 1, reserved in company table - $this->createOrderStepsProcessor->execute($order, OrderSteps::PROCESSING, 1); - - //Pre-approved order, no need Admin to process it - //This processor then calls Generate Order Steps - $this->confirmOrderProcessor->execute($order->id, $contract_obligation_list, $orderRoles); + $this->createOrderRolesProcessor->execute($request, $order); return $order; } diff --git a/app/Classes/Modules/Orders/Processors/CreateOrderProcessorOld.php b/app/Classes/Modules/Orders/Processors/CreateOrderProcessorOld.php new file mode 100644 index 00000000..ccb638ef --- /dev/null +++ b/app/Classes/Modules/Orders/Processors/CreateOrderProcessorOld.php @@ -0,0 +1,131 @@ +canCreateOrder = $canCreateOrder; + $this->createsOrder = $createsOrder; + $this->confirmOrderProcessor = $confirmOrderProcessor; + $this->createOrderStepsProcessor = $createOrderStepsProcessor; + $this->unityCreateContract = $unityCreateContract; + $this->unityAssignContractEntity = $unityAssignContractEntity; + $this->unityCreateContractEntity = $unityCreateContractEntity; + $this->unityActivateContract = $unityActivateContract; + $this->createOrderRoleProcessor = $createOrderRoleProcessor; + $this->createAddress = $createAddress; + $this->fetchesAddress = $fetchesAddress; + } + + + public function execute(Request $request){ + + $reference_no = rand(1000000, 9999999); + + //Call Unity to create contract and get contract reference no (and all the obligations) + $contract = $this->unityCreateContract->execute(); + $contract_reference_no = $contract->hash_id; + $contract_obligation_list = $contract->contract_obligation_list; + + //Activate Contract (if not activated then cannot update status) + $activated = $this->unityActivateContract->execute($contract_reference_no); + + //Create Order on Shipping Platform + $order_object = new OrderObject($request->get('company_module_id'), $reference_no, $contract_reference_no, OrderType::SHARED_CONTAINER, OrderStatus::PROCESSING, OrderSteps::PROCESSING, 0, $request->get('address_id'), $request->get('warehouse_id')); + $this->canCreateOrder->passes($order_object); + $order = $this->createsOrder->execute($order_object); + + $address = $this->fetchesAddress->execute(['id' => $order_object->getAddressId()]); + + $addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode,$address->reference); + + //Add address (polymorphic) + $this->createAddress->execute($order, $addressObject); + + //Add order roles - Allow entity to process this order + //This processor calls Unity to create Contract Entity ID + $orderRoles = $this->createOrderRoleProcessor->execute($request, $order->id, $contract_reference_no); + + //Call Unity to assign contract entity to obligation + $this->unityAssignContractEntity->execute($request, $orderRoles, $contract_obligation_list); + + //Add processing to order step + //Note: For processing apointee_id is CIEF Freight Forward , id is 1, reserved in company table + $this->createOrderStepsProcessor->execute($order, OrderSteps::PROCESSING, 1); + + //Pre-approved order, no need Admin to process it + //This processor then calls Generate Order Steps + $this->confirmOrderProcessor->execute($order->id, $contract_obligation_list, $orderRoles); + + return $order; + } +} diff --git a/app/Classes/Modules/Orders/Processors/CreateOrderRoleProcessor.php b/app/Classes/Modules/Orders/Processors/CreateOrderRoleProcessor.php deleted file mode 100644 index 0dd2240a..00000000 --- a/app/Classes/Modules/Orders/Processors/CreateOrderRoleProcessor.php +++ /dev/null @@ -1,61 +0,0 @@ -canCreateOrderRole = $canCreateOrderRole; - $this->createsOrderRole = $createsOrderRole; - $this->fetchesCompany = $fetchesCompany; - $this->unityCreateContractEntity = $unityCreateContractEntity; - } - - public function execute(Request $request, int $orderId, string $contract_reference_no){ - - $companies = $this->fetchesCompany->getRepository()->whereIn('id',[1, $request->get('warehouse_id')])->get(); - - $cief_company = $companies[0]->id == 1 ? $companies[0] : $companies[1]; - $warehouse_company = $companies[0]->id != 1 ? $companies[0] : $companies[1]; - - $cief_company_module = $cief_company->companyModule()->first(); - $contractEntities[] = $this->unityCreateContractEntity->execute( $contract_reference_no, [$cief_company_module->unity_hash_id]); - $contractEntities[0]->{"company_module_id"} = $cief_company_module->id; - - $warehouse_company_module = $warehouse_company->companyModule()->first(); - $contractEntities[] = $this->unityCreateContractEntity->execute( $contract_reference_no, [$warehouse_company_module->unity_hash_id]); - $contractEntities[1]->{"company_module_id"} = $warehouse_company_module->id; - - foreach($contractEntities as $entity){ - $order_role_object = new OrderRoleObject($orderId, $entity->company_module_id, $entity->hash_id, $entity->entity_signature_hash_id); - - $this->canCreateOrderRole->passes($order_role_object); - - $this->createsOrderRole->execute($order_role_object); - } - - return $contractEntities; - } -} diff --git a/app/Classes/Modules/Orders/Processors/CreateOrderRolesProcessor.php b/app/Classes/Modules/Orders/Processors/CreateOrderRolesProcessor.php new file mode 100644 index 00000000..650db2fe --- /dev/null +++ b/app/Classes/Modules/Orders/Processors/CreateOrderRolesProcessor.php @@ -0,0 +1,84 @@ +fetchesCompanyModule = $fetchesCompanyModule; + $this->createsOrderRole = $createsOrderRole; + $this->fetchesCompany = $fetchesCompany; + } + + + public function execute(Request $request, Order $order){ + + $address = $order->addresses()->first(); + + $importer = $order->companyModule; + + /** @var CompanyModule $originWarehouse */ + $originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->get('warehouse_id')]); + + /** @var CompanyModule $destinationWarehouse */ + $destinationWarehouse = $this->fetchesCompanyModule->execute(['reference' => $address->state_id === 13 ? WarehouseReferences::SABAH : $address->state_id === 14 ? WarehouseReferences::SARAWAK : WarehouseReferences::KLANG]); + + /** @var CompanyModule $freightForwarder */ + $freightForwarder = $originWarehouse->company->companyModules()->freightForwarders()->first(); + + /** @var CompanyModule $supervisor */ + $supervisor = $this->fetchesCompany->execute(['reference' => 'CIEF'])->companyModules()->freightForwarders()->first(); + + $roleObject = new OrderRoleObject($order, $supervisor, OrderRoleTypes::SUPERVISOR); + $this->createsOrderRole->execute($roleObject); + + $roleObject = new OrderRoleObject($order, $importer, OrderRoleTypes::IMPORTER); + $this->createsOrderRole->execute($roleObject); + + $roleObject = new OrderRoleObject($order, $originWarehouse, OrderRoleTypes::ORIGIN_WAREHOUSE); + $this->createsOrderRole->execute($roleObject); + + $roleObject = new OrderRoleObject($order, $freightForwarder, OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER); + $this->createsOrderRole->execute($roleObject); + + $roleObject = new OrderRoleObject($order, $freightForwarder, OrderRoleTypes::DESTINATION_FREIGHT_FORWARDER); + $this->createsOrderRole->execute($roleObject); + + $roleObject = new OrderRoleObject($order, $destinationWarehouse, OrderRoleTypes::DESTINATION_WAREHOUSE); + $this->createsOrderRole->execute($roleObject); + + $roleObject = new OrderRoleObject($order, $freightForwarder, OrderRoleTypes::LAST_MILE_DELIVERY_DRIVER); + $this->createsOrderRole->execute($roleObject); + + return true; + } +} diff --git a/app/Classes/Modules/Orders/Services/ChecksIfOrderNumberExists.php b/app/Classes/Modules/Orders/Services/ChecksIfOrderNumberExists.php new file mode 100644 index 00000000..701d6167 --- /dev/null +++ b/app/Classes/Modules/Orders/Services/ChecksIfOrderNumberExists.php @@ -0,0 +1,28 @@ +repository = $repository; + } + + public function execute(int $orderNumber): bool { + return $this->repository->where('reference', $orderNumber)->exists(); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Orders/Services/CreatesOrder.php b/app/Classes/Modules/Orders/Services/CreatesOrder.php index 6354c479..e89b3ad4 100644 --- a/app/Classes/Modules/Orders/Services/CreatesOrder.php +++ b/app/Classes/Modules/Orders/Services/CreatesOrder.php @@ -3,27 +3,27 @@ namespace App\Classes\Modules\Orders\Services; use App\Classes\General\Eloquent\AbstractUpdateRecord; +use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord; use App\Classes\Modules\Orders\DataTransferObjects\OrderObject; +use App\Models\CompanyModule; use App\Models\Order; -class CreatesOrder extends AbstractUpdateRecord +class CreatesOrder extends AbstractUpdateRelationshipRecord { /** + * @param CompanyModule $companyModule * @param OrderObject $object * @return \Illuminate\Database\Eloquent\Model * @throws \App\Classes\Exceptions\MalformedRequestException */ - public function execute(OrderObject $object) + public function execute(CompanyModule $companyModule, OrderObject $object) { $model = new Order(); - $model->company_module_id = $object->getCompanyModuleId(); $model->reference = $object->getReference(); - $model->reference_contract = $object->getReferenceContract(); $model->type = $object->getType(); $model->status = $object->getStatus(); - $model->current_step = $object->getCurrentStep(); - return $this->handler($model); + return $this->handler($companyModule->orders(), $model); } } diff --git a/app/Classes/Modules/Orders/Services/CreatesOrderRole.php b/app/Classes/Modules/Orders/Services/CreatesOrderRole.php index 387321b9..8799c0ee 100644 --- a/app/Classes/Modules/Orders/Services/CreatesOrderRole.php +++ b/app/Classes/Modules/Orders/Services/CreatesOrderRole.php @@ -3,25 +3,26 @@ namespace App\Classes\Modules\Orders\Services; use App\Classes\General\Eloquent\AbstractUpdateRecord; +use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord; use App\Classes\Modules\Orders\DataTransferObjects\OrderRoleObject; +use App\Models\CompanyModule; +use App\Models\Order; use App\Models\OrderRole; -class CreatesOrderRole extends AbstractUpdateRecord +class CreatesOrderRole extends AbstractUpdateRelationshipRecord { /** - * @param OrderObject $object + * @param OrderRoleObject $object * @return \Illuminate\Database\Eloquent\Model * @throws \App\Classes\Exceptions\MalformedRequestException */ public function execute(OrderRoleObject $object) { $model = new OrderRole(); - $model->order_id = $object->getOrderId(); - $model->company_module_id = $object->getCompanyModuleId(); - $model->role_hash_id = $object->getRoleHashId(); - $model->role_signature = $object->getRoleSignature(); + $model->role_id = $object->getRole(); + $model->company_module_id = $object->getCompanyModule()->id; - return $this->handler($model); + return $this->handler($object->getOrder()->OrderRoles(), $model); } } diff --git a/app/Classes/Modules/Orders/Services/GeneratesOrderNumber.php b/app/Classes/Modules/Orders/Services/GeneratesOrderNumber.php new file mode 100644 index 00000000..2fc25cc2 --- /dev/null +++ b/app/Classes/Modules/Orders/Services/GeneratesOrderNumber.php @@ -0,0 +1,31 @@ +checkIfOrderNumberExists = $checkIfOrderNumberExists; + } + + + /** + * @return int + */ + public function execute(): int { + + $reference = rand(1000000, 9999999); + return !$this->checkIfOrderNumberExists->execute($reference) ? $reference : self::execute(); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Orders/Standards/Rules/CanCreateOrder.php b/app/Classes/Modules/Orders/Standards/Rules/CanCreateOrder.php index c0fee466..2554cea2 100644 --- a/app/Classes/Modules/Orders/Standards/Rules/CanCreateOrder.php +++ b/app/Classes/Modules/Orders/Standards/Rules/CanCreateOrder.php @@ -7,6 +7,7 @@ use App\Classes\Modules\Orders\Standards\Validators\OrderValidation; class CanCreateOrder extends AbstractRule { + /** @var OrderValidation */ private $orderValidation; public function __construct(OrderValidation $orderValidation) @@ -23,19 +24,22 @@ class CanCreateOrder extends AbstractRule return true; } + /** + * @param $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ protected function validators($object): bool { return $this->orderValidation->validate($object); } /** - * @param CompanyObject $object + * @param $object * @return bool */ protected function criteria($object): bool { - //Verify account? - //Contract created on Unity return true; } } \ No newline at end of file diff --git a/app/Classes/Modules/Orders/Standards/Validators/OrderValidation.php b/app/Classes/Modules/Orders/Standards/Validators/OrderValidation.php index 53e38ff8..f21fd4d2 100644 --- a/app/Classes/Modules/Orders/Standards/Validators/OrderValidation.php +++ b/app/Classes/Modules/Orders/Standards/Validators/OrderValidation.php @@ -13,13 +13,7 @@ class OrderValidation extends AbstractValidation */ protected function data($object): array { - return [ - 'company_module_id' => $object->getCompanyModuleId(), - 'reference' => $object->getReference(), - 'reference_contract' => $object->getReferenceContract(), - 'warehouse_id' => $object->getWarehouseId(), - 'address_id' => $object->getAddressId(), - ]; + return []; } /** @@ -28,19 +22,7 @@ class OrderValidation extends AbstractValidation */ protected function rules(?string $type = 'POST'): array { - if ($type == 'POST') { - return [ - 'company_module_id' => 'required', - 'warehouse_id'=>'required', - 'address_id'=>'required', - 'reference' => '', - 'reference_contract' => '' - ]; - } elseif ($type == 'PUT') { - return [ - 'id' => 'required' - ]; - } + return []; } /** diff --git a/app/Classes/Modules/Unity/Services/CreatesEntity.php b/app/Classes/Modules/Unity/Services/CreatesEntity.php index 4cd13130..1eacbe00 100644 --- a/app/Classes/Modules/Unity/Services/CreatesEntity.php +++ b/app/Classes/Modules/Unity/Services/CreatesEntity.php @@ -20,7 +20,7 @@ class CreatesEntity public function execute($entity_name){ - $accesToken=$this->getAccessToken->execute(); + $accesToken= $this->getAccessToken->execute(); $response = Http::withToken($accesToken)->post($this->createEntityEndpoint,['name'=>$entity_name])->object(); diff --git a/app/Classes/ValueObjects/Constants/BusinessType.php b/app/Classes/ValueObjects/Constants/BusinessType.php index dd39c542..376b4807 100644 --- a/app/Classes/ValueObjects/Constants/BusinessType.php +++ b/app/Classes/ValueObjects/Constants/BusinessType.php @@ -4,12 +4,18 @@ namespace App\Classes\ValueObjects\Constants; final class BusinessType { - public const FREIGHT_FORWARDER = 1; + public const SUPPLIER = 0; - public const IMPORTER = 2; + public const IMPORTER = 1; - public const CURRENCY_VENDOR = 3; + public const FREIGHT_FORWARDER = 2; - public const WAREHOUSE = 4; + public const WAREHOUSE = 3; + + public const CUSTOM_CLEARANCE_AGENT = 4; + + public const DRIVER = 5; + + public const CURRENCY_VENDOR = 5; } diff --git a/app/Classes/ValueObjects/Constants/OrderRoleTypes.php b/app/Classes/ValueObjects/Constants/OrderRoleTypes.php new file mode 100644 index 00000000..e18363c9 --- /dev/null +++ b/app/Classes/ValueObjects/Constants/OrderRoleTypes.php @@ -0,0 +1,29 @@ + (int) $this->type, 'status' => (int) $this->status, 'current_step' => $this->current_step, - 'company' => new CompanyResource(Company::where('id',$this->companyModule()->first()->company_id)->first()), - 'address' => new AddressResource($this->when($this->has('addresses'), $this->addresses->where('owner_id', $this->id)->first())), - 'order_steps' => OrderStepResource::collection($this->orderSteps()->get()), + 'company' => new CompanyResource($this->companyModule->company), + 'address' => new AddressResource($this->address) ]; } } diff --git a/app/Models/Company.php b/app/Models/Company.php index bd137a4a..1921d8f2 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -44,21 +44,13 @@ class Company extends AbstractModel implements Documentable, Contactable } /** - * @return belongsToMany + * @return HasMany */ - public function companyModule(): hasMany + public function companyModules(): hasMany { return $this->hasMany(CompanyModule::class); } - /** - * @return belongsToMany - */ - public function segments(): belongsToMany - { - return $this->belongsToMany(Segment::class, (new SegmentCompany())->getTable(), 'company_id', 'segment_id'); - } - /** * @return belongsToMany */ @@ -88,35 +80,7 @@ class Company extends AbstractModel implements Documentable, Contactable */ public function banks(): HasMany { - return $this->HasMany(Bank::class, 'company_id'); + return $this->HasMany(BankAccount::class, 'company_id'); } - /** - * @return HasMany - */ - public function bookings(): HasMany - { - return $this->HasMany(Booking::class, 'company_id'); - } - - /** - * @return Builder - */ - public function services(): Builder { - return ServiceType::where('status', ApprovalStatus::APPROVED)->whereHas('constants', function($query) { - $query->Where(function($query){ - $query->where('reference', SegmentConstants::SERVICE_TYPE)->where('detail->is_active', true); - })->orWhere(function($query) { - $query->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->where('detail->is_active', true)->whereIn('segment_id', $this->segments->pluck('id')); - }); - }); - } - - public function servicesConfigurations(): Collection { - return $this->services()->get()->map(function($service) { - return new ServiceConfigurationsObject($service, - $service->constants->where('reference', SegmentConstants::SERVICE_TYPE)->first(), - $service->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE)->whereIn('segment_id', $this->segments->pluck('id'))); - }); - } } diff --git a/app/Models/CompanyModule.php b/app/Models/CompanyModule.php index e2ba6634..93a58027 100644 --- a/app/Models/CompanyModule.php +++ b/app/Models/CompanyModule.php @@ -3,7 +3,11 @@ namespace App\Models; use App\Classes\General\Interfaces\Addressable; +use App\Classes\General\Interfaces\Contactable; use App\Classes\General\Interfaces\Documentable; +use App\Classes\ValueObjects\Constants\BusinessType; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -11,6 +15,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; +use PhpParser\Node\Expr\AssignOp\Mod; /** * Class CompanyModule @@ -20,7 +25,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property integer type * @property integer status */ -class CompanyModule extends AbstractModel implements Addressable, Documentable +class CompanyModule extends AbstractModel implements Addressable, Documentable, Contactable { use SoftDeletes; @@ -92,4 +97,31 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable return $this->HasMany(Bank::class, 'company_id'); } + /** + * @param Builder $query + * @return Builder + */ + public function scopeFreightForwarders(Builder $query) + { + return $query->where('type', '=', BusinessType::FREIGHT_FORWARDER); + } + + /** + * @param Builder $query + * @return Builder + */ + public function scopeImporters(Builder $query) + { + return $query->where('type', '=', BusinessType::IMPORTER); + } + + /** + * @param Builder $query + * @return Builder + */ + public function scopeWarehouses(Builder $query) + { + return $query->where('type', '=', BusinessType::WAREHOUSE); + } + } diff --git a/app/Models/Order.php b/app/Models/Order.php index 1a1212e8..74920652 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -3,10 +3,9 @@ namespace App\Models; use App\Classes\General\Interfaces\Addressable; -use Illuminate\Database\Eloquent\SoftDeletes; -use Illuminate\Database\Eloquent\Relations\BelongsToMany; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\MorphMany; class Order extends AbstractModel implements Addressable @@ -32,4 +31,12 @@ class Order extends AbstractModel implements Addressable { return $this->morphMany(Address::class, 'owner'); } + + /** + * @return HasMany + */ + public function OrderRoles(): HasMany + { + return $this->HasMany(OrderRole::class, 'order_id'); + } } diff --git a/app/Models/OrderRole.php b/app/Models/OrderRole.php index 9c5c155f..1d80603c 100644 --- a/app/Models/OrderRole.php +++ b/app/Models/OrderRole.php @@ -4,8 +4,25 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class OrderRole extends Model { use HasFactory; + + /** + * @return BelongsTo + */ + public function Order(): BelongsTo + { + return $this->BelongsTo( Order::class, 'order_id', 'id'); + } + + /** + * @return BelongsTo + */ + public function Appointee(): BelongsTo + { + return $this->BelongsTo( CompanyModule::class, 'company_module_id', 'id'); + } } diff --git a/config/unity.php b/config/unity.php index 9b85c764..aa66ce8c 100644 --- a/config/unity.php +++ b/config/unity.php @@ -5,7 +5,7 @@ use App\Classes\Modules\OrderSteps\Processors\Steps as Step; return [ - 'url' => env('UNITY_API_URL', 'https://dev.unity.izyim.com/user-backsys/api/'), + 'url' => env('UNITY_API_URL', env('UNITY_APP_URL').'/user-backsys/api/'), 'endpoint' => [ 'login' => env('UNITY_LOGIN_ENDPOINT','login'), diff --git a/database/migrations/2021_06_21_232944_create_addresses_table.php b/database/migrations/2021_06_21_232944_create_addresses_table.php index b75b4777..78b826a1 100644 --- a/database/migrations/2021_06_21_232944_create_addresses_table.php +++ b/database/migrations/2021_06_21_232944_create_addresses_table.php @@ -1,6 +1,7 @@ string('postcode', '45'); $table->integer('type')->default(AddressType::DELIVERY); $table->integer('default')->default(false); + $table->integer('status')->default(ApprovalStatus::APPROVED); $table->softDeletes(); $table->timestamps(); }); diff --git a/database/migrations/2021_06_23_152229_create_company_modules_table.php b/database/migrations/2021_06_23_152229_create_company_modules_table.php index ca7162d3..a2dd1d34 100644 --- a/database/migrations/2021_06_23_152229_create_company_modules_table.php +++ b/database/migrations/2021_06_23_152229_create_company_modules_table.php @@ -18,8 +18,12 @@ class CreateCompanyModulesTable extends Migration Schema::create('company_modules', function (Blueprint $table) { $table->id(); $table->foreignId('company_id')->constrained(); + $table->string('name'); + $table->string('reference','45'); $table->integer('type')->default(CompanyType::COMPANY_BUSINESS); $table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION); + $table->string('unity_hash_id',200)->nullable(false); + $table->string('unity_signature',200)->nullable(false); $table->softDeletes(); $table->timestamps(); }); diff --git a/database/migrations/2021_07_07_174510_create_orders_table.php b/database/migrations/2021_07_07_174510_create_orders_table.php index 8ea309dc..07467c8b 100644 --- a/database/migrations/2021_07_07_174510_create_orders_table.php +++ b/database/migrations/2021_07_07_174510_create_orders_table.php @@ -16,11 +16,10 @@ class CreateOrdersTable extends Migration Schema::create('orders', function (Blueprint $table) { $table->id(); $table->bigInteger('company_module_id')->unsigned()->index()->comment('Entity responsible to create this order'); - $table->string('reference')->comment('Reference no for user '); - $table->string('reference_contract')->comment('Reference no from Unity platform'); + $table->string('reference'); + $table->string('reference_contract')->nullable(); $table->integer('type')->default(0)->comment('Order packages can be shipped in shared or dedicated container'); $table->integer('status')->default(0)->comment('Status of this order, e.g. processing, shipping etc.'); - $table->string('current_step')->nullable(false)->comment('Current steps is quick reference for order steps'); $table->softDeletes(); $table->timestamps(); diff --git a/database/migrations/2021_07_07_174624_create_order_steps_table.php b/database/migrations/2021_07_07_174624_create_steps_table.php similarity index 54% rename from database/migrations/2021_07_07_174624_create_order_steps_table.php rename to database/migrations/2021_07_07_174624_create_steps_table.php index d848984a..90b97903 100644 --- a/database/migrations/2021_07_07_174624_create_order_steps_table.php +++ b/database/migrations/2021_07_07_174624_create_steps_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateOrderStepsTable extends Migration +class CreateStepsTable extends Migration { /** * Run the migrations. @@ -13,21 +13,20 @@ class CreateOrderStepsTable extends Migration */ public function up() { - Schema::create('order_steps', function (Blueprint $table) { + Schema::create('steps', function (Blueprint $table) { $table->id(); - $table->bigInteger('order_id')->unsigned()->index(); - $table->bigInteger('appointee_id')->unsigned()->index()->comment(''); - $table->string('reference')->comment('Reference no for user '); + $table->Morphs('owner'); + $table->bigInteger('appointee_id')->unsigned()->index(); + $table->string('obligation_hash_id',200)->nullable(); + $table->string('reference'); $table->integer('primary')->default(0); $table->decimal('sequence', 4, 2); - $table->integer('status')->default(0)->comment('Status of this order, e.g. processing, shipping etc.'); - $table->integer('contract_status')->default(0)->comment('Status of this order, e.g. processing, shipping etc.'); + $table->integer('status')->default(0); $table->date('complete_date')->nullable(); $table->softDeletes(); $table->timestamps(); $table->foreign('appointee_id')->references('id')->on('company_modules'); - $table->foreign('order_id')->references('id')->on('orders'); }); } @@ -38,6 +37,6 @@ class CreateOrderStepsTable extends Migration */ public function down() { - Schema::dropIfExists('order_steps'); + Schema::dropIfExists('steps'); } } diff --git a/database/migrations/2021_07_07_174640_create_order_roles_table.php b/database/migrations/2021_07_07_174640_create_order_roles_table.php index 2dc2eb8c..8c1d3200 100644 --- a/database/migrations/2021_07_07_174640_create_order_roles_table.php +++ b/database/migrations/2021_07_07_174640_create_order_roles_table.php @@ -1,5 +1,6 @@ id(); $table->bigInteger('order_id')->unsigned()->index()->comment('Order id'); - $table->bigInteger('company_module_id')->unsigned()->index()->comment('Entity plays a role in this order, e.g. Freight Forwarder'); - $table->integer('role')->default(0)->comment('Describe role participate in processing order'); + $table->bigInteger('company_module_id')->unsigned()->index(); + $table->integer('role_id')->default(OrderRoleTypes::IMPORTER); + $table->string('entity_hash_id',200)->nullable(); + $table->string('entity_signature',200)->nullable(); $table->softDeletes(); $table->timestamps(); diff --git a/database/migrations/2021_07_21_110059_create_packing_lists_table.php b/database/migrations/2021_07_21_110059_create_packing_lists_table.php index 460dd35f..9492c5d4 100644 --- a/database/migrations/2021_07_21_110059_create_packing_lists_table.php +++ b/database/migrations/2021_07_21_110059_create_packing_lists_table.php @@ -16,6 +16,7 @@ class CreatePackingListsTable extends Migration Schema::create('packing_lists', function (Blueprint $table) { $table->id(); $table->string('reference',200); + $table->integer('type')->default(0); $table->integer('status')->default(0); $table->softDeletes(); $table->timestamps(); diff --git a/database/migrations/2021_07_22_145827_modify_company_table.php b/database/migrations/2021_07_22_145827_modify_company_table.php deleted file mode 100644 index 4ee5bbc0..00000000 --- a/database/migrations/2021_07_22_145827_modify_company_table.php +++ /dev/null @@ -1,31 +0,0 @@ -string('unity_hash_id',200)->nullable(false)->after('status'); - $table->string('unity_signature',200)->nullable(false)->after('unity_hash_id'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/database/migrations/2021_08_02_224659_modify_order_roles.php b/database/migrations/2021_08_02_224659_modify_order_roles.php deleted file mode 100644 index 9ef5b99e..00000000 --- a/database/migrations/2021_08_02_224659_modify_order_roles.php +++ /dev/null @@ -1,32 +0,0 @@ -dropColumn('role'); - $table->string('role_hash_id',200)->nullable(true)->after('company_module_id'); - $table->string('role_signature',200)->nullable(true)->after('role_hash_id'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/database/migrations/2021_08_03_014833_modify_order_steps.php b/database/migrations/2021_08_03_014833_modify_order_steps.php deleted file mode 100644 index cc566a9a..00000000 --- a/database/migrations/2021_08_03_014833_modify_order_steps.php +++ /dev/null @@ -1,30 +0,0 @@ -string('unity_hash_id',200)->nullable(true)->after('contract_status'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/database/migrations/2021_08_12_125207_alter_order_steps_table.php b/database/migrations/2021_08_12_125207_alter_order_steps_table.php deleted file mode 100644 index eceb2e45..00000000 --- a/database/migrations/2021_08_12_125207_alter_order_steps_table.php +++ /dev/null @@ -1,36 +0,0 @@ -dropForeign('order_steps_order_id_foreign'); - $table->dropColumn('order_id'); - $table->nullableMorphs('owner'); - }); - - Schema::table('order_steps', function (Blueprint $table) { - $table->string('owner_type', 191)->change(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/database/seeders/CompaniesTableSeeder.php b/database/seeders/CompaniesTableSeeder.php index aa68cf6e..53eae171 100644 --- a/database/seeders/CompaniesTableSeeder.php +++ b/database/seeders/CompaniesTableSeeder.php @@ -2,84 +2,136 @@ namespace Database\Seeders; +use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject; +use App\Classes\Modules\Addresses\Services\CreatesAddress; +use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject; +use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor; +use App\Classes\Modules\Companies\Services\CreatesCompany; +use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject; +use App\Classes\Modules\Contacts\Services\CreatesContact; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\CompanyType; use App\Classes\ValueObjects\Constants\BusinessType; -use App\Classes\Modules\Unity\Processors\CreateEntityProcessor; -use App\Classes\Modules\Unity\Processors\CreateEntitySignatureProcessor; +use App\Models\CompanyModule; use Illuminate\Database\Seeder; use App\Models\Company; -use App\Models\CompanyModule; class CompaniesTableSeeder extends Seeder { - private $createEntityProcessor; + /** @var CreatesCompany */ + private $createsCompany; - private $createEntitySignatureProcessor; + /** @var CreateCompanyModuleProcessor */ + private $createCompanyModuleProcessor; - public function __construct(CreateEntityProcessor $createEntityProcessor, CreateEntitySignatureProcessor $createEntitySignatureProcessor) + /** @var CreatesAddress */ + private $createsAddress; + + /** @var CreatesContact */ + private $createsContact; + + /** + * CompaniesTableSeeder constructor. + * @param CreatesCompany $createsCompany + * @param CreateCompanyModuleProcessor $createCompanyModuleProcessor + * @param CreatesAddress $createsAddress + * @param CreatesContact $createsContact + */ + public function __construct(CreatesCompany $createsCompany, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreatesAddress $createsAddress, CreatesContact $createsContact) { - $this->createEntityProcessor = $createEntityProcessor; - $this->createEntitySignatureProcessor = $createEntitySignatureProcessor; + $this->createsCompany = $createsCompany; + $this->createCompanyModuleProcessor = $createCompanyModuleProcessor; + $this->createsAddress = $createsAddress; + $this->createsContact = $createsContact; } + /** * Run the database seeds. * * @return void + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException */ public function run() { $companies = [ - [ - 'id' => 1, //Reserve ID - 'name' => 'CIEF SDN BHD', - 'reference' => 'CIEF', - 'type' => CompanyType::COMPANY_BUSINESS, - 'status' => ApprovalStatus::APPROVED, - ], - [ - 'name' => 'Guang Zhou', - 'reference' => 'guangzhouwarehouse', - 'type' => CompanyType::COMPANY_BUSINESS, - 'status' => ApprovalStatus::APPROVED, - ], - [ - 'name' => 'Yiwu', - 'reference' => 'yiwuwarehouse', - 'type' => CompanyType::COMPANY_BUSINESS, - 'status' => ApprovalStatus::APPROVED, - ] + new CompanyObject('CIEF Worldwide Sdn Bhd', 'CIEF', CompanyType::COMPANY_BUSINESS, ApprovalStatus::APPROVED), + new CompanyObject('Atvantic Import & Export Sdn Bhd', 'VT-NATION', CompanyType::COMPANY_BUSINESS, ApprovalStatus::APPROVED) ]; - if (!empty($companies)) { - foreach ($companies as $company) { + foreach ($companies as $companyObject) { - $unityEntity = $this->createEntityProcessor->execute($company['name']); + /** @var Company $company */ + $company = $this->createsCompany->execute($companyObject); - $unityEntitySignature = $this->createEntitySignatureProcessor->execute($unityEntity->hash_id); + if($companyObject->getReference() === 'CIEF') { + /** @var CompanyModule $companyModule */ + $companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::FREIGHT_FORWARDER); - $company = Company::create($company); + $address = new AddressObject('Malaysian Global Innovation & Creativity Center Level 1 CWS', 'Block 3730,Persiaran APEC', 1, 15, 402, 63000); + $this->createsAddress->execute($companyModule, $address); - $companyModule = [ - 'company_id' => $company->id, - 'type' => BusinessType::WAREHOUSE, - 'status' => ApprovalStatus::APPROVED, - 'unity_hash_id' => $unityEntity->hash_id, - 'unity_signature' => $unityEntitySignature->hash_id, - ]; + $contact = new ContactObject('Office Number', '0182909252', '', ''); + $this->createsContact->execute($companyModule, $contact); - if($company['reference']=='CIEF'){ - $companyModule['id']= 1; //Reserve ID - $companyModule['type']=BusinessType::FREIGHT_FORWARDER; + continue; + } + + foreach ([BusinessType::FREIGHT_FORWARDER, BusinessType::WAREHOUSE] as $businessType){ + + if($businessType === BusinessType::WAREHOUSE){ + foreach(['Guangzhou', 'Yiwu', 'Klang', 'Sabah', 'Sarawak'] as $name){ + + /** @var CompanyModule $companyModule */ + $companyModule = $this->createCompanyModuleProcessor->execute($company, $businessType); + + if ($name === 'Guangzhou'){ + $companyModule->update(['name' => $name, 'reference' => 'GZ-V01']); + $address = new AddressObject('白云区,大朗南路 白云湖大道自编13号 7号仓库', '高德地图导航:广州市世通行', 2, 35, 633, 510450); + $contact = new ContactObject('杨维民', '13600055019', '', ''); + } elseif ($name === 'Yiwu') { + $companyModule->update(['name' => $name, 'reference' => 'YW-V01']); + $address = new AddressObject('义乌市诚信大道义乌港A区2楼194号', '', 2, 27, 532, 322000); + $contact = new ContactObject('小曾', '13575982901', '', ''); + } elseif ($name === 'Klang') { + $companyModule->update(['name' => $name, 'reference' => 'KL-V01']); + $address = new AddressObject('LOT 1357 A, JALAN TANJUNG SHAWAL', 'KAMPUNG SUNGAI PINANG', 1, 15, 412, 41400); + $contact = new ContactObject('Mr. Yang', '0162237680', '', ''); + } elseif ($name === 'Sabah') { + $companyModule->update(['name' => $name, 'reference' => 'SB-V01']); + $address = new AddressObject('Warehouse A & B, No. 2, Lorong Kacang Tanah 1', 'Jalan Kolombong, Kolombong', 1, 13, 316, 88450); + } elseif ($name === 'Sarawak') { + $companyModule->update(['name' => $name, 'reference' => 'SRW-V01']); + $address = new AddressObject('OPPOSITE HT POLE 51, LT 664 JALAN SUNGAI SALIM', '', 1, 14, 381, 96000); + } + + + $this->createsAddress->execute($companyModule, $address); + $this->createsContact->execute($companyModule, $contact); + + } + + continue; } - CompanyModule::create($companyModule); + /** @var CompanyModule $companyModule */ + $companyModule = $this->createCompanyModuleProcessor->execute($company, $businessType); + + $address = new AddressObject('2, Jalan TSB 6, Taman Industri Sungai Buloh', '', 1, 15, 419, 47000); + $this->createsAddress->execute($companyModule, $address); + + $contact = new ContactObject('Office Number', '036148 8108', '', ''); + $this->createsContact->execute($companyModule, $contact); + } + + } } } diff --git a/database/seeders/DistrictsTableSeeder.php b/database/seeders/DistrictsTableSeeder.php index c27b28f9..610155ff 100644 --- a/database/seeders/DistrictsTableSeeder.php +++ b/database/seeders/DistrictsTableSeeder.php @@ -218,80 +218,80 @@ class DistrictsTableSeeder extends Seeder [201, 1, 8, 'Tanah Rata', json_encode(['39000','39007','39009','39010']), 1, '2020-05-06 02:09:02', '2020-05-06 02:09:02'], [202, 1, 8, 'Temerloh', json_encode(['28000','28007','28009','28010','28020','28030','28040']), 1, '2020-05-06 02:09:02', '2020-05-06 02:09:02'], [203, 1, 8, 'Triang', json_encode(['28200','28300','28310','28320','28330']), 1, '2020-05-06 02:09:02', '2020-05-06 02:09:02'], - [204, 1, 9, 'Ayer Tawar', json_encode(['32400']), 1, NULL, NULL], - [205, 1, 9, 'Bagan Datoh', json_encode(['36100']), 1, NULL, NULL], - [206, 1, 9, 'Bagan Serai', json_encode(['34300','34310']), 1, NULL, NULL], - [207, 1, 9, 'Bandar Seri Iskandar', json_encode(['32600','32610']), 1, NULL, NULL], - [208, 1, 9, 'Batu Gajah', json_encode(['31000','31007','31009']), 1, NULL, NULL], - [209, 1, 9, 'Batu Kurau', json_encode(['34500','34510','34520']), 1, NULL, NULL], - [210, 1, 9, 'Behrang Stesen', json_encode(['35950']), 1, NULL, NULL], - [211, 1, 9, 'Bidor', json_encode(['35500']), 1, NULL, NULL], - [212, 1, 9, 'Bota', json_encode(['32600']), 1, NULL, NULL], - [213, 1, 9, 'Bruas', json_encode(['32700']), 1, NULL, NULL], - [214, 1, 9, 'Changkat Jering', json_encode(['34850']), 1, NULL, NULL], - [215, 1, 9, 'Changkat Keruing', json_encode(['32500']), 1, NULL, NULL], - [216, 1, 9, 'Chemor', json_encode(['31200']), 1, NULL, NULL], - [217, 1, 9, 'Chenderiang', json_encode(['35300']), 1, NULL, NULL], - [218, 1, 9, 'Chenderong Balai', json_encode(['36600']), 1, NULL, NULL], - [219, 1, 9, 'Chikus', json_encode(['36750']), 1, NULL, NULL], - [220, 1, 9, 'Enggor', json_encode(['33600']), 1, NULL, NULL], - [221, 1, 9, 'Gerik', json_encode(['33300','33310','33320']), 1, NULL, NULL], - [222, 1, 9, 'Gopeng', json_encode(['31600','31610']), 1, NULL, NULL], - [223, 1, 9, 'Hutan Melintang', json_encode(['36400']), 1, NULL, NULL], - [224, 1, 9, 'Intan', json_encode(['33200']), 1, NULL, NULL], - [225, 1, 9, 'Ipoh', json_encode(['30000','30010','30020','30100','30200','30250','30300','30350','30450','30500','30502','30503','30504','30505','30506','30508','30510','30512','30516','30517','30518','30519','30520','30524','30532','30534','30536','30540','30542','30546','30548','30550','30551','30552','30554','30556','30560','30564','30570','30576','30580','30582','30586','30590','30592','30594','30596','30600','30604','30606','30609','30610','30612','30614','30620','30621','30622','30626','30628','30630','30632','30634','30644','30646','30648','30656','30658','30660','30661','30662','30664','30668','30670','30673','30674','30676','30682','30690','30700','30710','30720','30730','30740','30750','30760','30770','30780','30790','30800','30810','30820','30830','30840','30900','30902','30904','30906','30908','30910','30912','30988','30990','31350','31400','31407','31409','31450','31500','31650']), 1, NULL, NULL], - [226, 1, 9, 'Jeram', json_encode(['31850']), 1, NULL, NULL], - [227, 1, 9, 'Kampar', json_encode(['31900','31907','31909','31910','31920']), 1, NULL, NULL], - [228, 1, 9, 'Kampung Gajah', json_encode(['36800','36810']), 1, NULL, NULL], - [229, 1, 9, 'Kampung Kepayang', json_encode(['31300']), 1, NULL, NULL], - [230, 1, 9, 'Kamunting', json_encode(['34600']), 1, NULL, NULL], - [231, 1, 9, 'Kuala Kangsar', json_encode(['33000','33007','33009','33010','33020','33030','33040']), 1, NULL, NULL], - [232, 1, 9, 'Kuala Kurau', json_encode(['34350']), 1, NULL, NULL], - [233, 1, 9, 'Kuala Sepetang', json_encode(['34650']), 1, NULL, NULL], - [234, 1, 9, 'Lambor Kanan', json_encode(['32900']), 1, NULL, NULL], - [235, 1, 9, 'Langkap', json_encode(['36700']), 1, NULL, NULL], - [236, 1, 9, 'Lenggong', json_encode(['33400','33410','33420']), 1, NULL, NULL], - [237, 1, 9, 'Lumut', json_encode(['32200']), 1, NULL, NULL], - [238, 1, 9, 'Malim Nawar', json_encode(['31700']), 1, NULL, NULL], - [239, 1, 9, 'Mambang Di Awan', json_encode(['31900','31920','31950']), 1, NULL, NULL], - [240, 1, 9, 'Manong', json_encode(['33800']), 1, NULL, NULL], - [241, 1, 9, 'Matang', json_encode(['34750']), 1, NULL, NULL], - [242, 1, 9, 'Padang Rengas', json_encode(['33700']), 1, NULL, NULL], - [243, 1, 9, 'Pangkor', json_encode(['32300']), 1, NULL, NULL], - [244, 1, 9, 'Pantai Remis', json_encode(['34900']), 1, NULL, NULL], - [245, 1, 9, 'Parit', json_encode(['32800']), 1, NULL, NULL], - [246, 1, 9, 'Parit Buntar', json_encode(['34200']), 1, NULL, NULL], - [247, 1, 9, 'Pengkalan Hulu', json_encode(['33100']), 1, NULL, NULL], - [248, 1, 9, 'Pusing', json_encode(['31550','31560']), 1, NULL, NULL], - [249, 1, 9, 'Rantau Panjang', json_encode(['34140']), 1, NULL, NULL], - [250, 1, 9, 'Sauk', json_encode(['33500']), 1, NULL, NULL], - [251, 1, 9, 'Selama', json_encode(['34100','34120','34130']), 1, NULL, NULL], - [252, 1, 9, 'Selekoh', json_encode(['36200','36207','36209']), 1, NULL, NULL], - [253, 1, 9, 'Seri Manjong', json_encode(['32040']), 1, NULL, NULL], - [254, 1, 9, 'Seri Manjung', json_encode(['32040']), 1, NULL, NULL], - [255, 1, 9, 'Simpang', json_encode(['34700']), 1, NULL, NULL], - [256, 1, 9, 'Simpang Ampat Semanggol', json_encode(['34400']), 1, NULL, NULL], - [257, 1, 9, 'Sitiawan', json_encode(['32000']), 1, NULL, NULL], - [258, 1, 9, 'Slim River', json_encode(['35800','35820']), 1, NULL, NULL], - [259, 1, 9, 'Sungai Siput', json_encode(['31050','31100']), 1, NULL, NULL], - [260, 1, 9, 'Sungai Sumun', json_encode(['36300','36307','36309']), 1, NULL, NULL], - [261, 1, 9, 'Sungkai', json_encode(['35600']), 1, NULL, NULL], - [262, 1, 9, 'Taiping', json_encode(['34000','34007','34008','34009','34010','34020','34030']), 1, NULL, NULL], - [263, 1, 9, 'Tanah Rata', json_encode(['39000']), 1, NULL, NULL], - [264, 1, 9, 'Tanjong Malim', json_encode(['35900','35907','35909','35910']), 1, NULL, NULL], - [265, 1, 9, 'Tanjong Piandang', json_encode(['34250']), 1, NULL, NULL], - [266, 1, 9, 'Tanjong Rambutan', json_encode(['31250']), 1, NULL, NULL], - [267, 1, 9, 'Tanjong Tualang', json_encode(['31800']), 1, NULL, NULL], - [268, 1, 9, 'Tapah', json_encode(['35000','35007','35009']), 1, NULL, NULL], - [269, 1, 9, 'Tapah Road', json_encode(['35400']), 1, NULL, NULL], - [270, 1, 9, 'Teluk Intan', json_encode(['36000','36007','36008','36009','36010','36020','36030','36110']), 1, NULL, NULL], - [271, 1, 9, 'Temoh', json_encode(['35350']), 1, NULL, NULL], - [272, 1, 9, 'Tldm Lumut', json_encode(['32100']), 1, NULL, NULL], - [273, 1, 9, 'Trolak', json_encode(['35700']), 1, NULL, NULL], - [274, 1, 9, 'Trong', json_encode(['34800']), 1, NULL, NULL], - [275, 1, 9, 'Tronoh', json_encode(['31750']), 1, NULL, NULL], - [276, 1, 9, 'Ulu Bernam', json_encode(['36500']), 1, NULL, NULL], - [277, 1, 9, 'Ulu Kinta', json_encode(['31150']), 1, NULL, NULL], + [204, 1, 9, 'Ayer Tawar', json_encode(['32400']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [205, 1, 9, 'Bagan Datoh', json_encode(['36100']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [206, 1, 9, 'Bagan Serai', json_encode(['34300','34310']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [207, 1, 9, 'Bandar Seri Iskandar', json_encode(['32600','32610']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [208, 1, 9, 'Batu Gajah', json_encode(['31000','31007','31009']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [209, 1, 9, 'Batu Kurau', json_encode(['34500','34510','34520']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [210, 1, 9, 'Behrang Stesen', json_encode(['35950']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [211, 1, 9, 'Bidor', json_encode(['35500']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [212, 1, 9, 'Bota', json_encode(['32600']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [213, 1, 9, 'Bruas', json_encode(['32700']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [214, 1, 9, 'Changkat Jering', json_encode(['34850']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [215, 1, 9, 'Changkat Keruing', json_encode(['32500']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [216, 1, 9, 'Chemor', json_encode(['31200']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [217, 1, 9, 'Chenderiang', json_encode(['35300']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [218, 1, 9, 'Chenderong Balai', json_encode(['36600']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [219, 1, 9, 'Chikus', json_encode(['36750']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [220, 1, 9, 'Enggor', json_encode(['33600']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [221, 1, 9, 'Gerik', json_encode(['33300','33310','33320']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [222, 1, 9, 'Gopeng', json_encode(['31600','31610']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [223, 1, 9, 'Hutan Melintang', json_encode(['36400']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [224, 1, 9, 'Intan', json_encode(['33200']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [225, 1, 9, 'Ipoh', json_encode(['30000','30010','30020','30100','30200','30250','30300','30350','30450','30500','30502','30503','30504','30505','30506','30508','30510','30512','30516','30517','30518','30519','30520','30524','30532','30534','30536','30540','30542','30546','30548','30550','30551','30552','30554','30556','30560','30564','30570','30576','30580','30582','30586','30590','30592','30594','30596','30600','30604','30606','30609','30610','30612','30614','30620','30621','30622','30626','30628','30630','30632','30634','30644','30646','30648','30656','30658','30660','30661','30662','30664','30668','30670','30673','30674','30676','30682','30690','30700','30710','30720','30730','30740','30750','30760','30770','30780','30790','30800','30810','30820','30830','30840','30900','30902','30904','30906','30908','30910','30912','30988','30990','31350','31400','31407','31409','31450','31500','31650']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [226, 1, 9, 'Jeram', json_encode(['31850']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [227, 1, 9, 'Kampar', json_encode(['31900','31907','31909','31910','31920']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [228, 1, 9, 'Kampung Gajah', json_encode(['36800','36810']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [229, 1, 9, 'Kampung Kepayang', json_encode(['31300']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [230, 1, 9, 'Kamunting', json_encode(['34600']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [231, 1, 9, 'Kuala Kangsar', json_encode(['33000','33007','33009','33010','33020','33030','33040']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [232, 1, 9, 'Kuala Kurau', json_encode(['34350']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [233, 1, 9, 'Kuala Sepetang', json_encode(['34650']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [234, 1, 9, 'Lambor Kanan', json_encode(['32900']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [235, 1, 9, 'Langkap', json_encode(['36700']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [236, 1, 9, 'Lenggong', json_encode(['33400','33410','33420']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [237, 1, 9, 'Lumut', json_encode(['32200']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [238, 1, 9, 'Malim Nawar', json_encode(['31700']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [239, 1, 9, 'Mambang Di Awan', json_encode(['31900','31920','31950']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [240, 1, 9, 'Manong', json_encode(['33800']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [241, 1, 9, 'Matang', json_encode(['34750']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [242, 1, 9, 'Padang Rengas', json_encode(['33700']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [243, 1, 9, 'Pangkor', json_encode(['32300']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [244, 1, 9, 'Pantai Remis', json_encode(['34900']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [245, 1, 9, 'Parit', json_encode(['32800']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [246, 1, 9, 'Parit Buntar', json_encode(['34200']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [247, 1, 9, 'Pengkalan Hulu', json_encode(['33100']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [248, 1, 9, 'Pusing', json_encode(['31550','31560']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [249, 1, 9, 'Rantau Panjang', json_encode(['34140']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [250, 1, 9, 'Sauk', json_encode(['33500']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [251, 1, 9, 'Selama', json_encode(['34100','34120','34130']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [252, 1, 9, 'Selekoh', json_encode(['36200','36207','36209']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [253, 1, 9, 'Seri Manjong', json_encode(['32040']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [254, 1, 9, 'Seri Manjung', json_encode(['32040']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [255, 1, 9, 'Simpang', json_encode(['34700']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [256, 1, 9, 'Simpang Ampat Semanggol', json_encode(['34400']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [257, 1, 9, 'Sitiawan', json_encode(['32000']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [258, 1, 9, 'Slim River', json_encode(['35800','35820']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [259, 1, 9, 'Sungai Siput', json_encode(['31050','31100']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [260, 1, 9, 'Sungai Sumun', json_encode(['36300','36307','36309']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [261, 1, 9, 'Sungkai', json_encode(['35600']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [262, 1, 9, 'Taiping', json_encode(['34000','34007','34008','34009','34010','34020','34030']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [263, 1, 9, 'Tanah Rata', json_encode(['39000']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [264, 1, 9, 'Tanjong Malim', json_encode(['35900','35907','35909','35910']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [265, 1, 9, 'Tanjong Piandang', json_encode(['34250']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [266, 1, 9, 'Tanjong Rambutan', json_encode(['31250']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [267, 1, 9, 'Tanjong Tualang', json_encode(['31800']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [268, 1, 9, 'Tapah', json_encode(['35000','35007','35009']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [269, 1, 9, 'Tapah Road', json_encode(['35400']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [270, 1, 9, 'Teluk Intan', json_encode(['36000','36007','36008','36009','36010','36020','36030','36110']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [271, 1, 9, 'Temoh', json_encode(['35350']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [272, 1, 9, 'Tldm Lumut', json_encode(['32100']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [273, 1, 9, 'Trolak', json_encode(['35700']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [274, 1, 9, 'Trong', json_encode(['34800']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [275, 1, 9, 'Tronoh', json_encode(['31750']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [276, 1, 9, 'Ulu Bernam', json_encode(['36500']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], + [277, 1, 9, 'Ulu Kinta', json_encode(['31150']), 1, '2020-05-06 02:08:57', '2020-05-06 02:08:57'], [278, 1, 10, 'Arau', json_encode(['02600','02607','02609']), 1, '2020-05-06 02:09:03', '2020-05-06 02:09:03'], [279, 1, 10, 'Kaki Bukit', json_encode(['02200']), 1, '2020-05-06 02:09:03', '2020-05-06 02:09:03'], [280, 1, 10, 'Kangar', json_encode(['01000','01007','01009','01500','01502','01503','01504','01505','01506','01508','01512','01514','01516','01517','01518','01524','01529','01532','01538','01540','01546','01550','01551','01556','01560','01564','01570','01572','01576','01578','01582','01586','01590','01592','01594','01596','01598','01600','01604','01606','01608','01609','01610','01612','01614','01620','01622','01626','01628','01630','01632','01634','01644','01646','01648','01660','01664','01670','01672','01673','01674','01676','01680','01694','02400','02450','02500']), 1, '2020-05-06 02:09:03', '2020-05-06 02:09:03'], @@ -456,7 +456,341 @@ class DistrictsTableSeeder extends Seeder [439, 1, 15, 'Sungai Pelek', json_encode(['43950']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], [440, 1, 15, 'Tanjong Karang', json_encode(['45500']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], [441, 1, 15, 'Tanjong Sepat', json_encode(['42800']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], - [442, 1, 15, 'Telok Panglima Garang', json_encode(['42425','42500','42507','42509']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'] + [442, 1, 15, 'Telok Panglima Garang', json_encode(['42425','42500','42507','42509']), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [443, 2, 19, '石家庄市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [444, 2, 19, '唐山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [445, 2, 19, '秦皇岛市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [446, 2, 19, '邯郸市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [447, 2, 19, '邢台市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [448, 2, 19, '保定市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [449, 2, 19, '张家口市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [450, 2, 19, '承德市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [451, 2, 19, '沧州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [452, 2, 19, '廊坊市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [453, 2, 19, '衡水市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [454, 2, 20, '太原市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [455, 2, 20, '大同市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [456, 2, 20, '阳泉市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [457, 2, 20, '长治市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [458, 2, 20, '晋城市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [459, 2, 20, '朔州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [460, 2, 20, '晋中市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [461, 2, 20, '运城市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [462, 2, 20, '忻州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [463, 2, 20, '临汾市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [464, 2, 20, '吕梁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [465, 2, 21, '呼和浩特市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [466, 2, 21, '包头市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [467, 2, 21, '乌海市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [468, 2, 21, '赤峰市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [469, 2, 21, '通辽市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [470, 2, 21, '鄂尔多斯市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [471, 2, 21, '呼伦贝尔市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [472, 2, 21, '巴彦淖尔市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [473, 2, 21, '乌兰察布市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [474, 2, 21, '兴安盟', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [475, 2, 21, '锡林郭勒盟', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [476, 2, 21, '阿拉善盟', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [477, 2, 22, '沈阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [478, 2, 22, '大连市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [479, 2, 22, '鞍山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [480, 2, 22, '抚顺市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [481, 2, 22, '本溪市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [482, 2, 22, '丹东市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [483, 2, 22, '锦州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [484, 2, 22, '营口市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [485, 2, 22, '阜新市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [486, 2, 22, '辽阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [487, 2, 22, '盘锦市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [488, 2, 22, '铁岭市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [489, 2, 22, '朝阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [490, 2, 22, '葫芦岛市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [491, 2, 23, '长春市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [492, 2, 23, '吉林市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [493, 2, 23, '四平市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [494, 2, 23, '辽源市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [495, 2, 23, '通化市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [496, 2, 23, '白山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [497, 2, 23, '松原市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [498, 2, 23, '白城市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [499, 2, 23, '延边朝鲜族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [500, 2, 24, '哈尔滨市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [501, 2, 24, '齐齐哈尔市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [502, 2, 24, '鸡西市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [503, 2, 24, '鹤岗市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [504, 2, 24, '双鸭山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [505, 2, 24, '大庆市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [506, 2, 24, '伊春市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [507, 2, 24, '佳木斯市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [508, 2, 24, '七台河市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [509, 2, 24, '牡丹江市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [510, 2, 24, '黑河市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [511, 2, 24, '绥化市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [512, 2, 24, '大兴安岭地区', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [513, 2, 26, '南京市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [514, 2, 26, '无锡市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [515, 2, 26, '徐州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [516, 2, 26, '常州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [517, 2, 26, '苏州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [518, 2, 26, '南通市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [519, 2, 26, '连云港市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [520, 2, 26, '淮安市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [521, 2, 26, '盐城市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [522, 2, 26, '扬州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [523, 2, 26, '镇江市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [524, 2, 26, '泰州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [525, 2, 26, '宿迁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [526, 2, 27, '杭州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [527, 2, 27, '宁波市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [528, 2, 27, '温州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [529, 2, 27, '嘉兴市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [530, 2, 27, '湖州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [531, 2, 27, '绍兴市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [532, 2, 27, '金华市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [533, 2, 27, '衢州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [534, 2, 27, '舟山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [535, 2, 27, '台州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [536, 2, 27, '丽水市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [537, 2, 28, '合肥市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [538, 2, 28, '芜湖市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [539, 2, 28, '蚌埠市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [540, 2, 28, '淮南市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [541, 2, 28, '马鞍山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [542, 2, 28, '淮北市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [543, 2, 28, '铜陵市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [544, 2, 28, '安庆市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [545, 2, 28, '黄山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [546, 2, 28, '滁州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [547, 2, 28, '阜阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [548, 2, 28, '宿州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [549, 2, 28, '六安市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [550, 2, 28, '亳州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [551, 2, 28, '池州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [552, 2, 28, '宣城市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [553, 2, 29, '福州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [554, 2, 29, '厦门市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [555, 2, 29, '莆田市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [556, 2, 29, '三明市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [557, 2, 29, '泉州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [558, 2, 29, '漳州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [559, 2, 29, '南平市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [560, 2, 29, '龙岩市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [561, 2, 29, '宁德市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [562, 2, 30, '南昌市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [563, 2, 30, '景德镇市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [564, 2, 30, '萍乡市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [565, 2, 30, '九江市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [566, 2, 30, '新余市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [567, 2, 30, '鹰潭市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [568, 2, 30, '赣州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [569, 2, 30, '吉安市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [570, 2, 30, '宜春市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [571, 2, 30, '抚州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [572, 2, 30, '上饶市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [573, 2, 31, '济南市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [574, 2, 31, '青岛市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [575, 2, 31, '淄博市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [576, 2, 31, '枣庄市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [577, 2, 31, '东营市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [578, 2, 31, '烟台市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [579, 2, 31, '潍坊市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [580, 2, 31, '济宁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [581, 2, 31, '泰安市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [582, 2, 31, '威海市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [583, 2, 31, '日照市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [584, 2, 31, '临沂市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [585, 2, 31, '德州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [586, 2, 31, '聊城市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [587, 2, 31, '滨州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [588, 2, 31, '菏泽市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [589, 2, 32, '郑州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [590, 2, 32, '开封市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [591, 2, 32, '洛阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [592, 2, 32, '平顶山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [593, 2, 32, '安阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [594, 2, 32, '鹤壁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [595, 2, 32, '新乡市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [596, 2, 32, '焦作市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [597, 2, 32, '濮阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [598, 2, 32, '许昌市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [599, 2, 32, '漯河市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [600, 2, 32, '三门峡市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [601, 2, 32, '南阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [602, 2, 32, '商丘市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [603, 2, 32, '信阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [604, 2, 32, '周口市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [605, 2, 32, '驻马店市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [606, 2, 33, '武汉市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [607, 2, 33, '黄石市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [608, 2, 33, '十堰市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [609, 2, 33, '宜昌市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [610, 2, 33, '襄阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [611, 2, 33, '鄂州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [612, 2, 33, '荆门市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [613, 2, 33, '孝感市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [614, 2, 33, '荆州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [615, 2, 33, '黄冈市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [616, 2, 33, '咸宁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [617, 2, 33, '随州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [618, 2, 33, '恩施土家族苗族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [619, 2, 34, '长沙市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [620, 2, 34, '株洲市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [621, 2, 34, '湘潭市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [622, 2, 34, '衡阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [623, 2, 34, '邵阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [624, 2, 34, '岳阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [625, 2, 34, '常德市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [626, 2, 34, '张家界市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [627, 2, 34, '益阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [628, 2, 34, '郴州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [629, 2, 34, '永州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [630, 2, 34, '怀化市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [631, 2, 34, '娄底市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [632, 2, 34, '湘西土家族苗族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [633, 2, 35, '广州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [634, 2, 35, '韶关市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [635, 2, 35, '深圳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [636, 2, 35, '珠海市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [637, 2, 35, '汕头市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [638, 2, 35, '佛山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [639, 2, 35, '江门市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [640, 2, 35, '湛江市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [641, 2, 35, '茂名市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [642, 2, 35, '肇庆市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [643, 2, 35, '惠州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [644, 2, 35, '梅州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [645, 2, 35, '汕尾市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [646, 2, 35, '河源市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [647, 2, 35, '阳江市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [648, 2, 35, '清远市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [649, 2, 35, '东莞市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [650, 2, 35, '中山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [651, 2, 35, '潮州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [652, 2, 35, '揭阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [653, 2, 35, '云浮市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [654, 2, 36, '南宁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [655, 2, 36, '柳州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [656, 2, 36, '桂林市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [657, 2, 36, '梧州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [658, 2, 36, '北海市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [659, 2, 36, '防城港市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [660, 2, 36, '钦州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [661, 2, 36, '贵港市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [662, 2, 36, '玉林市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [663, 2, 36, '百色市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [664, 2, 36, '贺州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [665, 2, 36, '河池市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [666, 2, 36, '来宾市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [667, 2, 36, '崇左市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [668, 2, 37, '海口市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [669, 2, 37, '三亚市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [670, 2, 37, '三沙市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [671, 2, 37, '儋州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [672, 2, 39, '成都市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [673, 2, 39, '自贡市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [674, 2, 39, '攀枝花市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [675, 2, 39, '泸州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [676, 2, 39, '德阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [677, 2, 39, '绵阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [678, 2, 39, '广元市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [679, 2, 39, '遂宁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [680, 2, 39, '内江市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [681, 2, 39, '乐山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [682, 2, 39, '南充市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [683, 2, 39, '眉山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [684, 2, 39, '宜宾市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [685, 2, 39, '广安市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [686, 2, 39, '达州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [687, 2, 39, '雅安市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [688, 2, 39, '巴中市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [689, 2, 39, '资阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [690, 2, 39, '阿坝藏族羌族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [691, 2, 39, '甘孜藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [692, 2, 39, '凉山彝族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [693, 2, 40, '贵阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [694, 2, 40, '六盘水市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [695, 2, 40, '遵义市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [696, 2, 40, '安顺市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [697, 2, 40, '毕节市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [698, 2, 40, '铜仁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [699, 2, 40, '黔西南布依族苗族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [700, 2, 40, '黔东南苗族侗族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [701, 2, 40, '黔南布依族苗族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [702, 2, 41, '昆明市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [703, 2, 41, '曲靖市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [704, 2, 41, '玉溪市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [705, 2, 41, '保山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [706, 2, 41, '昭通市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [707, 2, 41, '丽江市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [708, 2, 41, '普洱市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [709, 2, 41, '临沧市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [710, 2, 41, '楚雄彝族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [711, 2, 41, '红河哈尼族彝族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [712, 2, 41, '文山壮族苗族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [713, 2, 41, '西双版纳傣族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [714, 2, 41, '大理白族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [715, 2, 41, '德宏傣族景颇族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [716, 2, 41, '怒江傈僳族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [717, 2, 41, '迪庆藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [718, 2, 42, '拉萨市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [719, 2, 42, '日喀则市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [720, 2, 42, '昌都市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [721, 2, 42, '林芝市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [722, 2, 42, '山南市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [723, 2, 42, '那曲市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [724, 2, 42, '阿里地区', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [725, 2, 43, '西安市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [726, 2, 43, '铜川市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [727, 2, 43, '宝鸡市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [728, 2, 43, '咸阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [729, 2, 43, '渭南市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [730, 2, 43, '延安市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [731, 2, 43, '汉中市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [732, 2, 43, '榆林市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [733, 2, 43, '安康市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [734, 2, 43, '商洛市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [735, 2, 44, '兰州市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [736, 2, 44, '嘉峪关市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [737, 2, 44, '金昌市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [738, 2, 44, '白银市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [739, 2, 44, '天水市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [740, 2, 44, '武威市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [741, 2, 44, '张掖市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [742, 2, 44, '平凉市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [743, 2, 44, '酒泉市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [744, 2, 44, '庆阳市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [745, 2, 44, '定西市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [746, 2, 44, '陇南市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [747, 2, 44, '临夏回族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [748, 2, 44, '甘南藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [749, 2, 45, '西宁市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [750, 2, 45, '海东市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [751, 2, 45, '海北藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [752, 2, 45, '黄南藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [753, 2, 45, '海南藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [754, 2, 45, '果洛藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [755, 2, 45, '玉树藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [756, 2, 45, '海西蒙古族藏族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [757, 2, 46, '银川市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [758, 2, 46, '石嘴山市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [759, 2, 46, '吴忠市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [760, 2, 46, '固原市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [761, 2, 46, '中卫市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [762, 2, 47, '乌鲁木齐市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [763, 2, 47, '克拉玛依市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [764, 2, 47, '吐鲁番市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [765, 2, 47, '哈密市', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [766, 2, 47, '昌吉回族自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [767, 2, 47, '博尔塔拉蒙古自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [768, 2, 47, '巴音郭楞蒙古自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [769, 2, 47, '阿克苏地区', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [770, 2, 47, '克孜勒苏柯尔克孜自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [771, 2, 47, '喀什地区', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [772, 2, 47, '和田地区', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [773, 2, 47, '伊犁哈萨克自治州', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [774, 2, 47, '塔城地区', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [775, 2, 47, '阿勒泰地区', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'], + [776, 2, 33, '省直辖县级行政区划', json_encode([]), 1, '2020-05-06 02:09:07', '2020-05-06 02:09:07'] ]; diff --git a/database/seeders/StatesTableSeeder.php b/database/seeders/StatesTableSeeder.php index 422d033f..b95f00ba 100644 --- a/database/seeders/StatesTableSeeder.php +++ b/database/seeders/StatesTableSeeder.php @@ -31,6 +31,7 @@ class StatesTableSeeder extends Seeder { $malaysia = $this->fetchesCountry->execute(['name' => country('my')->getName()]); + $china = $this->fetchesCountry->execute(['name' => country('cn')->getName()]); DB::table('states')->insert([ [ 'country_id' => $malaysia->id, @@ -56,7 +57,7 @@ class StatesTableSeeder extends Seeder 'country_id' => $malaysia->id, 'name' => 'Labuan', 'status' => 1 - + ], [ 'country_id' => $malaysia->id, @@ -114,5 +115,43 @@ class StatesTableSeeder extends Seeder 'status' => 1 ] ]); + + + DB::table('states')->insert([ + [ 'country_id' => $china->id, 'name'=> '北京市', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '天津市', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '河北省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '山西省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '内蒙古自治区', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '辽宁省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '吉林省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '黑龙江省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '上海市', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '江苏省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '浙江省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '安徽省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '福建省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '江西省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '山东省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '河南省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '湖北省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '湖南省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '广东省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '广西壮族自治区', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '海南省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '重庆市', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '四川省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '贵州省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '云南省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '西藏自治区', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '陕西省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '甘肃省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '青海省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '宁夏回族自治区', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '新疆维吾尔自治区', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '台湾省', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '香港特别行政区', 'status' => 1 ], + [ 'country_id' => $china->id, 'name'=> '澳门特别行政区', 'status' => 1 ] + ]); } } diff --git a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue index 04cae09f..f36fc902 100644 --- a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue +++ b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue @@ -7,7 +7,7 @@
-
+
@@ -50,7 +50,7 @@
-

Personal Information

+

Account Information

@@ -61,50 +61,6 @@
-
-
- - - - -
-
- - - - -
-
-
-
-

Account Information

-
-
- -
-
- - - - -
-
- -
-
- - - - -
-
- - - - -
-
-
@@ -199,7 +155,6 @@
-
- +
+
+
+
+
+

Personal Information

+
+
+
+
+ + + + +
+
+ + + + +
+
+
+
+ + + + +
+
+ +
+
+ + + + +
+
+ + + + +
+
+
+
+ +
+
+ +
+
+
+
@@ -254,10 +277,27 @@ } }, methods:{ + changeStep(direction){ + + if(direction === 'next'){ + if(this.validate()){ + this.$v.$reset(); + this.step += 1; + } + return; + } + + this.parameters.email = ''; + this.parameters.password = ''; + this.parameters.password_confirmation = ''; + + return this.step -= 1 + + }, submitForm(){ - this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false); + this.step === 2 ? this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false) : this.changeStep('next'); } }, - mixins: [registrationFormValidation,stepNavi] + mixins: [registrationFormValidation] } diff --git a/resources/assets/vue/components/orders/forms/OrderFormComponent.vue b/resources/assets/vue/components/orders/forms/OrderFormComponent.vue index 774a2914..a8837a19 100644 --- a/resources/assets/vue/components/orders/forms/OrderFormComponent.vue +++ b/resources/assets/vue/components/orders/forms/OrderFormComponent.vue @@ -13,7 +13,7 @@
-
+
@@ -21,13 +21,13 @@
-
Guangzhou
+
Guangzhou
-
+
@@ -35,7 +35,7 @@
-
Yiwu
+
Yiwu
@@ -73,7 +73,7 @@ -
+
@@ -92,7 +92,7 @@
-
+
@@ -143,7 +143,7 @@ parameters : { warehouse_id: '', address_id: '', - company_module_id: this.$store.getters.getCompanyModuleId, + company_id: this.$store.getters.getCompanyId, } } }, @@ -164,6 +164,9 @@ }, 5000); }, + errorHandler(){ + this.step--; + } } } diff --git a/resources/assets/vue/general/mixins/accounts/validation/registrationFormValidation.js b/resources/assets/vue/general/mixins/accounts/validation/registrationFormValidation.js index 69e6ead0..35ec708f 100644 --- a/resources/assets/vue/general/mixins/accounts/validation/registrationFormValidation.js +++ b/resources/assets/vue/general/mixins/accounts/validation/registrationFormValidation.js @@ -4,24 +4,24 @@ export default { validations: { parameters: { name: { - required, + required: requiredIf(function () { return this.step === 2 }) }, email: { - required, + required: requiredIf(function () { return this.step === 2 }), email }, company_name: { required: requiredIf(function () { return this.parameters.type === 1 }) }, phone: { - required, + required: requiredIf(function () { return this.step === 2 }), numeric }, password: { - required + required: requiredIf(function () { return this.step === 2 }), }, password_confirmation: { - required, + required: requiredIf(function () { return this.step === 2 }), sameAs: sameAs('password') }, identification_no:{