From faf1f1c1f18a800e9659066505df238dde0cc565 Mon Sep 17 00:00:00 2001 From: gerchek Date: Tue, 29 Mar 2022 00:31:40 +0500 Subject: [PATCH] card credit api worked --- .../controllers/api/CarddataController.php | 99 +++++++++++++++++ .../controllers/api/CreditdataController.php | 103 ++++++++++++++++++ plugins/ahmadfatoni/apigenerator/routes.php | 6 +- .../controllers/CardDataController.php | 19 ++++ .../controllers/CreditDataController.php | 19 ++++ .../carddatacontroller/_list_toolbar.htm | 19 ++++ .../carddatacontroller/_reorder_toolbar.htm | 3 + .../carddatacontroller/config_form.yaml | 10 ++ .../carddatacontroller/config_list.yaml | 12 ++ .../carddatacontroller/config_reorder.yaml | 4 + .../controllers/carddatacontroller/create.htm | 46 ++++++++ .../controllers/carddatacontroller/index.htm | 1 + .../carddatacontroller/preview.htm | 22 ++++ .../carddatacontroller/reorder.htm | 8 ++ .../controllers/carddatacontroller/update.htm | 54 +++++++++ .../creditdatacontroller/_list_toolbar.htm | 19 ++++ .../creditdatacontroller/_reorder_toolbar.htm | 3 + .../creditdatacontroller/config_form.yaml | 10 ++ .../creditdatacontroller/config_list.yaml | 12 ++ .../creditdatacontroller/config_reorder.yaml | 4 + .../creditdatacontroller/create.htm | 46 ++++++++ .../creditdatacontroller/index.htm | 1 + .../creditdatacontroller/preview.htm | 22 ++++ .../creditdatacontroller/reorder.htm | 8 ++ .../creditdatacontroller/update.htm | 54 +++++++++ plugins/atash/contact/models/Card_data.php | 37 +++++++ plugins/atash/contact/models/Credit_data.php | 37 +++++++ .../contact/models/card_data/columns.yaml | 7 ++ .../contact/models/card_data/fields.yaml | 37 +++++++ .../contact/models/credit_data/columns.yaml | 7 ++ .../contact/models/credit_data/fields.yaml | 42 +++++++ plugins/atash/contact/plugin.yaml | 12 +- ...r_table_create_atash_contact_card_data.php | 25 +++++ ...table_create_atash_contact_credit_data.php | 28 +++++ ...r_table_update_atash_contact_card_data.php | 23 ++++ plugins/atash/contact/updates/version.yaml | 9 ++ 36 files changed, 861 insertions(+), 7 deletions(-) create mode 100644 plugins/ahmadfatoni/apigenerator/controllers/api/CarddataController.php create mode 100644 plugins/ahmadfatoni/apigenerator/controllers/api/CreditdataController.php create mode 100644 plugins/atash/contact/controllers/CardDataController.php create mode 100644 plugins/atash/contact/controllers/CreditDataController.php create mode 100644 plugins/atash/contact/controllers/carddatacontroller/_list_toolbar.htm create mode 100644 plugins/atash/contact/controllers/carddatacontroller/_reorder_toolbar.htm create mode 100644 plugins/atash/contact/controllers/carddatacontroller/config_form.yaml create mode 100644 plugins/atash/contact/controllers/carddatacontroller/config_list.yaml create mode 100644 plugins/atash/contact/controllers/carddatacontroller/config_reorder.yaml create mode 100644 plugins/atash/contact/controllers/carddatacontroller/create.htm create mode 100644 plugins/atash/contact/controllers/carddatacontroller/index.htm create mode 100644 plugins/atash/contact/controllers/carddatacontroller/preview.htm create mode 100644 plugins/atash/contact/controllers/carddatacontroller/reorder.htm create mode 100644 plugins/atash/contact/controllers/carddatacontroller/update.htm create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/_list_toolbar.htm create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/_reorder_toolbar.htm create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/config_form.yaml create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/config_list.yaml create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/config_reorder.yaml create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/create.htm create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/index.htm create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/preview.htm create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/reorder.htm create mode 100644 plugins/atash/contact/controllers/creditdatacontroller/update.htm create mode 100644 plugins/atash/contact/models/Card_data.php create mode 100644 plugins/atash/contact/models/Credit_data.php create mode 100644 plugins/atash/contact/models/card_data/columns.yaml create mode 100644 plugins/atash/contact/models/card_data/fields.yaml create mode 100644 plugins/atash/contact/models/credit_data/columns.yaml create mode 100644 plugins/atash/contact/models/credit_data/fields.yaml create mode 100644 plugins/atash/contact/updates/builder_table_create_atash_contact_card_data.php create mode 100644 plugins/atash/contact/updates/builder_table_create_atash_contact_credit_data.php create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_card_data.php diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/CarddataController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/CarddataController.php new file mode 100644 index 0000000..ce3d528 --- /dev/null +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/CarddataController.php @@ -0,0 +1,99 @@ +Card_data = $Card_data; + $this->helpers = $helpers; + } + + public function index(){ + + $data = $this->Card_data->all()->toArray(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); + } + + public function show($id){ + + $data = $this->Card_data::find($id); + + if ($data){ + return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]); + } else { + $this->helpers->apiArrayResponseBuilder(404, 'not found', ['error' => 'Resource id=' . $id . ' could not be found']); + } + + } + + public function store(Request $request){ + + $arr = $request->all(); + + while ( $data = current($arr)) { + $this->Card_data->{key($arr)} = $data; + next($arr); + } + + $validation = Validator::make($request->all(), $this->Card_data->rules); + + if( $validation->passes() ){ + $this->Card_data->save(); + return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->Card_data->id]); + }else{ + return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); + } + + } + + public function update($id, Request $request){ + + $status = $this->Card_data->where('id',$id)->update($data); + + if( $status ){ + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been updated successfully.'); + + }else{ + + return $this->helpers->apiArrayResponseBuilder(400, 'bad request', 'Error, data failed to update.'); + + } + } + + public function delete($id){ + + $this->Card_data->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + public function destroy($id){ + + $this->Card_data->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + + public static function getAfterFilters() {return [];} + public static function getBeforeFilters() {return [];} + public static function getMiddleware() {return [];} + public function callAction($method, $parameters=false) { + return call_user_func_array(array($this, $method), $parameters); + } + +} \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/CreditdataController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/CreditdataController.php new file mode 100644 index 0000000..34a4a80 --- /dev/null +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/CreditdataController.php @@ -0,0 +1,103 @@ +Credit_data = $Credit_data; + $this->helpers = $helpers; + } + + public function index(){ + + // $data = $this->Credit_data->all()->toArray(); + // $data = $this->Credit_data->with(['translations:sum,securing_return,source_of_repayment,repayment_method'])->get(); + $data = $this->Credit_data->with(['translations:locale,model_id,attribute_data'])->get(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); + + // return response()->json($data, 200); + } + + public function show($id){ + + $data = $this->Credit_data::find($id); + + if ($data){ + return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]); + } else { + $this->helpers->apiArrayResponseBuilder(404, 'not found', ['error' => 'Resource id=' . $id . ' could not be found']); + } + + } + + public function store(Request $request){ + + $arr = $request->all(); + + while ( $data = current($arr)) { + $this->Credit_data->{key($arr)} = $data; + next($arr); + } + + $validation = Validator::make($request->all(), $this->Credit_data->rules); + + if( $validation->passes() ){ + $this->Credit_data->save(); + return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->Credit_data->id]); + }else{ + return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); + } + + } + + public function update($id, Request $request){ + + $status = $this->Credit_data->where('id',$id)->update($data); + + if( $status ){ + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been updated successfully.'); + + }else{ + + return $this->helpers->apiArrayResponseBuilder(400, 'bad request', 'Error, data failed to update.'); + + } + } + + public function delete($id){ + + $this->Credit_data->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + public function destroy($id){ + + $this->Credit_data->where('id',$id)->delete(); + + return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); + } + + + public static function getAfterFilters() {return [];} + public static function getBeforeFilters() {return [];} + public static function getMiddleware() {return [];} + public function callAction($method, $parameters=false) { + return call_user_func_array(array($this, $method), $parameters); + } + +} \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/routes.php b/plugins/ahmadfatoni/apigenerator/routes.php index af652f8..4611e9b 100644 --- a/plugins/ahmadfatoni/apigenerator/routes.php +++ b/plugins/ahmadfatoni/apigenerator/routes.php @@ -4,5 +4,7 @@ Route::post('fatoni/generate/api', array('as' => 'fatoni.generate.api', 'uses' = Route::post('fatoni/update/api/{id}', array('as' => 'fatoni.update.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@updateApi')); Route::get('fatoni/delete/api/{id}', array('as' => 'fatoni.delete.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@deleteApi')); -Route::resource('user_sign_in', 'AhmadFatoni\ApiGenerator\Controllers\API\usersigninController', ['except' => ['destroy', 'create', 'edit']]); -Route::get('user_sign_in/{id}/delete', ['as' => 'user_sign_in.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\usersigninController@destroy']); \ No newline at end of file +Route::resource('api/v1/credit_data', 'AhmadFatoni\ApiGenerator\Controllers\API\Credit dataController', ['except' => ['destroy', 'create', 'edit']]); +Route::get('api/v1/credit_data/{id}/delete', ['as' => 'api/v1/credit_data.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\Credit dataController@destroy']); +Route::resource('api/v1/card_data', 'AhmadFatoni\ApiGenerator\Controllers\API\CarddataController', ['except' => ['destroy', 'create', 'edit']]); +Route::get('api/v1/card_data/{id}/delete', ['as' => 'api/v1/card_data.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\CarddataController@destroy']); \ No newline at end of file diff --git a/plugins/atash/contact/controllers/CardDataController.php b/plugins/atash/contact/controllers/CardDataController.php new file mode 100644 index 0000000..414ca1d --- /dev/null +++ b/plugins/atash/contact/controllers/CardDataController.php @@ -0,0 +1,19 @@ + + + + + diff --git a/plugins/atash/contact/controllers/carddatacontroller/_reorder_toolbar.htm b/plugins/atash/contact/controllers/carddatacontroller/_reorder_toolbar.htm new file mode 100644 index 0000000..f902798 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/_reorder_toolbar.htm @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/plugins/atash/contact/controllers/carddatacontroller/config_form.yaml b/plugins/atash/contact/controllers/carddatacontroller/config_form.yaml new file mode 100644 index 0000000..032a3a1 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/config_form.yaml @@ -0,0 +1,10 @@ +name: CardDataController +form: $/atash/contact/models/card_data/fields.yaml +modelClass: Atash\Contact\Models\Card_data +defaultRedirect: atash/contact/carddatacontroller +create: + redirect: 'atash/contact/carddatacontroller/update/:id' + redirectClose: atash/contact/carddatacontroller +update: + redirect: atash/contact/carddatacontroller + redirectClose: atash/contact/carddatacontroller diff --git a/plugins/atash/contact/controllers/carddatacontroller/config_list.yaml b/plugins/atash/contact/controllers/carddatacontroller/config_list.yaml new file mode 100644 index 0000000..3004e4d --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/config_list.yaml @@ -0,0 +1,12 @@ +list: $/atash/contact/models/card_data/columns.yaml +modelClass: Atash\Contact\Models\Card_data +title: CardDataController +noRecordsMessage: 'backend::lang.list.no_records' +showSetup: true +showCheckboxes: true +recordsPerPage: 20 +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' +recordUrl: 'atash/contact/carddatacontroller/update/:id' diff --git a/plugins/atash/contact/controllers/carddatacontroller/config_reorder.yaml b/plugins/atash/contact/controllers/carddatacontroller/config_reorder.yaml new file mode 100644 index 0000000..ad576ae --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/config_reorder.yaml @@ -0,0 +1,4 @@ +title: CardDataController +modelClass: Atash\Contact\Models\Card_data +toolbar: + buttons: reorder_toolbar diff --git a/plugins/atash/contact/controllers/carddatacontroller/create.htm b/plugins/atash/contact/controllers/carddatacontroller/create.htm new file mode 100644 index 0000000..f04e707 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/carddatacontroller/index.htm b/plugins/atash/contact/controllers/carddatacontroller/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/plugins/atash/contact/controllers/carddatacontroller/preview.htm b/plugins/atash/contact/controllers/carddatacontroller/preview.htm new file mode 100644 index 0000000..1df81ee --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

\ No newline at end of file diff --git a/plugins/atash/contact/controllers/carddatacontroller/reorder.htm b/plugins/atash/contact/controllers/carddatacontroller/reorder.htm new file mode 100644 index 0000000..bdc0e01 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/reorder.htm @@ -0,0 +1,8 @@ + + + + +reorderRender() ?> \ No newline at end of file diff --git a/plugins/atash/contact/controllers/carddatacontroller/update.htm b/plugins/atash/contact/controllers/carddatacontroller/update.htm new file mode 100644 index 0000000..44779c9 --- /dev/null +++ b/plugins/atash/contact/controllers/carddatacontroller/update.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + + + +
+
+ + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/creditdatacontroller/_list_toolbar.htm b/plugins/atash/contact/controllers/creditdatacontroller/_list_toolbar.htm new file mode 100644 index 0000000..8c66b90 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/_list_toolbar.htm @@ -0,0 +1,19 @@ +
+ + + +
diff --git a/plugins/atash/contact/controllers/creditdatacontroller/_reorder_toolbar.htm b/plugins/atash/contact/controllers/creditdatacontroller/_reorder_toolbar.htm new file mode 100644 index 0000000..a687fea --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/_reorder_toolbar.htm @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/plugins/atash/contact/controllers/creditdatacontroller/config_form.yaml b/plugins/atash/contact/controllers/creditdatacontroller/config_form.yaml new file mode 100644 index 0000000..74345a9 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/config_form.yaml @@ -0,0 +1,10 @@ +name: CreditDataController +form: $/atash/contact/models/credit_data/fields.yaml +modelClass: Atash\Contact\Models\Credit_data +defaultRedirect: atash/contact/creditdatacontroller +create: + redirect: 'atash/contact/creditdatacontroller/update/:id' + redirectClose: atash/contact/creditdatacontroller +update: + redirect: atash/contact/creditdatacontroller + redirectClose: atash/contact/creditdatacontroller diff --git a/plugins/atash/contact/controllers/creditdatacontroller/config_list.yaml b/plugins/atash/contact/controllers/creditdatacontroller/config_list.yaml new file mode 100644 index 0000000..fcd5a56 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/config_list.yaml @@ -0,0 +1,12 @@ +list: $/atash/contact/models/credit_data/columns.yaml +modelClass: Atash\Contact\Models\Credit_data +title: CreditDataController +noRecordsMessage: 'backend::lang.list.no_records' +showSetup: true +showCheckboxes: true +recordsPerPage: 20 +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' +recordUrl: 'atash/contact/creditdatacontroller/update/:id' diff --git a/plugins/atash/contact/controllers/creditdatacontroller/config_reorder.yaml b/plugins/atash/contact/controllers/creditdatacontroller/config_reorder.yaml new file mode 100644 index 0000000..1eab8f2 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/config_reorder.yaml @@ -0,0 +1,4 @@ +title: CreditDataController +modelClass: Atash\Contact\Models\Credit_data +toolbar: + buttons: reorder_toolbar diff --git a/plugins/atash/contact/controllers/creditdatacontroller/create.htm b/plugins/atash/contact/controllers/creditdatacontroller/create.htm new file mode 100644 index 0000000..92a516f --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/creditdatacontroller/index.htm b/plugins/atash/contact/controllers/creditdatacontroller/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/plugins/atash/contact/controllers/creditdatacontroller/preview.htm b/plugins/atash/contact/controllers/creditdatacontroller/preview.htm new file mode 100644 index 0000000..3326082 --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

\ No newline at end of file diff --git a/plugins/atash/contact/controllers/creditdatacontroller/reorder.htm b/plugins/atash/contact/controllers/creditdatacontroller/reorder.htm new file mode 100644 index 0000000..81816db --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/reorder.htm @@ -0,0 +1,8 @@ + + + + +reorderRender() ?> \ No newline at end of file diff --git a/plugins/atash/contact/controllers/creditdatacontroller/update.htm b/plugins/atash/contact/controllers/creditdatacontroller/update.htm new file mode 100644 index 0000000..2f17bea --- /dev/null +++ b/plugins/atash/contact/controllers/creditdatacontroller/update.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + + + +
+
+ + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/atash/contact/models/Card_data.php b/plugins/atash/contact/models/Card_data.php new file mode 100644 index 0000000..e08d6ba --- /dev/null +++ b/plugins/atash/contact/models/Card_data.php @@ -0,0 +1,37 @@ + 'System\Models\File' + ]; + + public $implement = ['RainLab.Translate.Behaviors.TranslatableModel']; + + public $translatable = ['name','text']; +} diff --git a/plugins/atash/contact/models/Credit_data.php b/plugins/atash/contact/models/Credit_data.php new file mode 100644 index 0000000..3b235b6 --- /dev/null +++ b/plugins/atash/contact/models/Credit_data.php @@ -0,0 +1,37 @@ + 'System\Models\File' + // ]; +} diff --git a/plugins/atash/contact/models/card_data/columns.yaml b/plugins/atash/contact/models/card_data/columns.yaml new file mode 100644 index 0000000..82897ad --- /dev/null +++ b/plugins/atash/contact/models/card_data/columns.yaml @@ -0,0 +1,7 @@ +columns: + id: + label: id + type: number + name: + label: name + type: text diff --git a/plugins/atash/contact/models/card_data/fields.yaml b/plugins/atash/contact/models/card_data/fields.yaml new file mode 100644 index 0000000..c0578b9 --- /dev/null +++ b/plugins/atash/contact/models/card_data/fields.yaml @@ -0,0 +1,37 @@ +fields: + name: + label: 'Вид карты' + size: small + span: left + type: textarea + image: + label: Image + mode: image + useCaption: true + thumbOptions: + mode: crop + extension: auto + span: right + type: fileupload + text: + label: Text + size: small + span: full + type: textarea +tabs: + fields: + term: + label: 'Срок действия карты' + span: auto + type: number + tab: 'Tab 1' + interest_rate: + label: 'Процентная ставка' + span: auto + type: number + tab: 'Tab 1' + card_cost: + label: 'Стоимость карты' + span: auto + type: number + tab: 'Tab 1' diff --git a/plugins/atash/contact/models/credit_data/columns.yaml b/plugins/atash/contact/models/credit_data/columns.yaml new file mode 100644 index 0000000..82897ad --- /dev/null +++ b/plugins/atash/contact/models/credit_data/columns.yaml @@ -0,0 +1,7 @@ +columns: + id: + label: id + type: number + name: + label: name + type: text diff --git a/plugins/atash/contact/models/credit_data/fields.yaml b/plugins/atash/contact/models/credit_data/fields.yaml new file mode 100644 index 0000000..20dea72 --- /dev/null +++ b/plugins/atash/contact/models/credit_data/fields.yaml @@ -0,0 +1,42 @@ +fields: + name: + label: 'Вид кредита' + size: small + span: auto + type: textarea +tabs: + fields: + term: + label: Срок + span: left + type: number + tab: Data + sum: + label: 'Сумма кредита' + size: small + span: right + type: textarea + tab: Data + bet: + label: Ставка + span: left + type: number + tab: Data + securing_return: + label: 'Обеспечение возврата кредита' + size: small + span: right + type: textarea + tab: Data + source_of_repayment: + label: 'Источник погашения кредита' + size: small + span: left + type: textarea + tab: Data + repayment_method: + label: 'Способ погашения' + size: small + span: right + type: textarea + tab: Data diff --git a/plugins/atash/contact/plugin.yaml b/plugins/atash/contact/plugin.yaml index cad5fd8..fe66e20 100644 --- a/plugins/atash/contact/plugin.yaml +++ b/plugins/atash/contact/plugin.yaml @@ -25,11 +25,13 @@ navigation: permissions: - contact_form side-menu-item3: - label: 'Online credit branch' - url: atash/contact/onlinecardbranchcontroller - icon: icon-sitemap - permissions: - - online_card_branch_form + label: 'Вид кредита' + url: atash/contact/creditdatacontroller + icon: icon-credit-card + side-menu-item4: + label: 'Вид карты' + url: atash/contact/carddatacontroller + icon: icon-envelope permissions: contact_form: tab: Other diff --git a/plugins/atash/contact/updates/builder_table_create_atash_contact_card_data.php b/plugins/atash/contact/updates/builder_table_create_atash_contact_card_data.php new file mode 100644 index 0000000..1340102 --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_create_atash_contact_card_data.php @@ -0,0 +1,25 @@ +engine = 'InnoDB'; + $table->increments('id')->unsigned(); + $table->string('name'); + $table->integer('term'); + $table->integer('interest_rate'); + $table->integer('card_cost'); + }); + } + + public function down() + { + Schema::dropIfExists('atash_contact_card_data'); + } +} diff --git a/plugins/atash/contact/updates/builder_table_create_atash_contact_credit_data.php b/plugins/atash/contact/updates/builder_table_create_atash_contact_credit_data.php new file mode 100644 index 0000000..ab548ff --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_create_atash_contact_credit_data.php @@ -0,0 +1,28 @@ +engine = 'InnoDB'; + $table->increments('id')->unsigned(); + $table->string('name'); + $table->integer('term'); + $table->string('sum'); + $table->integer('bet'); + $table->text('securing_return'); + $table->text('source_of_repayment'); + $table->text('repayment_method'); + }); + } + + public function down() + { + Schema::dropIfExists('atash_contact_credit_data'); + } +} diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_card_data.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_card_data.php new file mode 100644 index 0000000..bd03b9c --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_card_data.php @@ -0,0 +1,23 @@ +text('text'); + }); + } + + public function down() + { + Schema::table('atash_contact_card_data', function($table) + { + $table->dropColumn('text'); + }); + } +} diff --git a/plugins/atash/contact/updates/version.yaml b/plugins/atash/contact/updates/version.yaml index 7b6c412..0cb3bea 100644 --- a/plugins/atash/contact/updates/version.yaml +++ b/plugins/atash/contact/updates/version.yaml @@ -66,3 +66,12 @@ 1.0.23: - 'Updated table atash_contact_online_card' - builder_table_update_atash_contact_online_card_5.php +1.0.24: + - 'Created table atash_contact_credit_data' + - builder_table_create_atash_contact_credit_data.php +1.0.25: + - 'Created table atash_contact_card_data' + - builder_table_create_atash_contact_card_data.php +1.0.26: + - 'Updated table atash_contact_card_data' + - builder_table_update_atash_contact_card_data.php