|
@@ -29,6 +29,13 @@
|
|
|
<div class="card card card-primary mb-3 mb-md-0 border-light">
|
|
|
{{-- <div class="card-header p-1 mb-2"> 핵심정보 </div> --}}
|
|
|
<div class="card-body">
|
|
|
+ <div class="form-group mb-3" {{ $formA['FormVars']['Hidden']['CompanyNo'] }}>
|
|
|
+ <label class = "m-0">{{ $formA['FormVars']['Title']['CompanyNo'] }}</label>
|
|
|
+ <br>
|
|
|
+ <input type="text" id="company-no-txt" data-copy="true" class="rounded w-100"
|
|
|
+ maxlength="{{ $formA['FormVars']['MaxLength']['CompanyNo'] }}"
|
|
|
+ {{ $formA['FormVars']['Required']['CompanyNo'] }}>
|
|
|
+ </div>
|
|
|
<div class="form-group mb-3" {{ $formA['FormVars']['Hidden']['TaxNo'] }}>
|
|
|
<label class = "m-0">{{ $formA['FormVars']['Title']['TaxNo'] }}</label>
|
|
|
<br>
|
|
@@ -77,6 +84,24 @@
|
|
|
{{ $formA['FormVars']['Required']['CgroupId'] }}>
|
|
|
</select>
|
|
|
</div>
|
|
|
+ <div class="form-group flex-column mb-3" id="seller-id-div" style="display: block;">
|
|
|
+ <label class="m-0" {{ $formA['FormVars']['Required']['SellerId'] }}>
|
|
|
+ {{ $formA['FormVars']['Title']['SellerId'] }}
|
|
|
+ </label>
|
|
|
+ <div class="d-flex">
|
|
|
+ <input type="text" id="seller-txt" data-id="1" class="rounded w-100 radius-r0" autocomplete="off"
|
|
|
+ onkeydown="company_model_show_cell_enter_key(event, '', 'CompanyForm')"
|
|
|
+ maxlength="{{ $formA['FormVars']['MaxLength']['SellerId'] }}"
|
|
|
+ {{ $formA['FormVars']['Required']['SellerId'] }}>
|
|
|
+ <button type="button" {{ $formA['FormVars']['Required']['SellerId'] === 'hidden' ? 'hidden' : '' }}
|
|
|
+ class="btn-dark rounded btn-open-modal border-0 radius-l0 col-3 CompanyForm company-modal-btn"
|
|
|
+ data-target="company"
|
|
|
+ data-clicked="CompanyForm.fetch_seller"
|
|
|
+ data-variable="companyModal">
|
|
|
+ <i class="icon-folder-open"></i>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="form-group mb-3" {{ $formA['FormVars']['Hidden']['MainContact'] }}>
|
|
|
<label class = "m-0">{{ $formA['FormVars']['Title']['MainContact'] }}</label>
|
|
|
<br>
|
|
@@ -183,6 +208,7 @@
|
|
|
maxlength="{{ $formA['FormVars']['MaxLength']['DealItem'] }}"
|
|
|
{{ $formA['FormVars']['Required']['DealItem'] }}>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -234,6 +260,19 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ $('#cgroup-id-select').on('change', function(){
|
|
|
+ const val = $(this).val()
|
|
|
+ switch (val) {
|
|
|
+ case '1':
|
|
|
+ case '2':
|
|
|
+ $('#seller-id-div').show()
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $('#seller-id-div').hide()
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
$('#full-name-txt').on('click', function(){
|
|
|
var companyName = $('#company-name-txt').val();
|
|
|
if(companyName){
|
|
@@ -278,20 +317,48 @@
|
|
|
$('#company-form').find('#cgroup-id-select').append(cgroup_id_select);
|
|
|
}
|
|
|
|
|
|
- CompanyForm.fetch_company = async function (id) {
|
|
|
- let response = await get_api_data(CompanyForm.formA['General']['PickApi'], {
|
|
|
+ CompanyForm.pick = async function (id) {
|
|
|
+ return await get_api_data(CompanyForm.formA['General']['PickApi'], {
|
|
|
Page: [ { Id: id } ]
|
|
|
})
|
|
|
+ }
|
|
|
+
|
|
|
+ CompanyForm.fetch_company = async function (id) {
|
|
|
+ const response = await CompanyForm.pick(id)
|
|
|
|
|
|
CompanyForm.set_company_ui(response)
|
|
|
}
|
|
|
|
|
|
+ CompanyForm.fetch_seller = async function (id) {
|
|
|
+ const response = await CompanyForm.pick(id)
|
|
|
+
|
|
|
+ if (isEmpty(response.data) || response.data.apiStatus) {
|
|
|
+ $('#modal-company').modal('hide')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const seller = response.data.Page[0]
|
|
|
+ $('#company-form').find('#seller-txt').val(seller['CompanyName'])
|
|
|
+ $('#company-form').find('#seller-txt').data('id', seller['Id'])
|
|
|
+ $('#modal-company').modal('hide')
|
|
|
+ }
|
|
|
+
|
|
|
CompanyForm.parameter = function () {
|
|
|
+ let sellerId = $('#company-form').find('#seller-txt').data('id')
|
|
|
+ switch ($('#cgroup-id-select').val()) {
|
|
|
+ case '3':
|
|
|
+ case '4':
|
|
|
+ case '5':
|
|
|
+ sellerId = $('#company-form').find('#Id').val()
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
let id = Number( $('#company-form').find('#Id').val());
|
|
|
let parameter = {
|
|
|
Id: id,
|
|
|
CreatedOn: get_now_time_stamp(),
|
|
|
UpdatedOn: get_now_time_stamp(),
|
|
|
+ CompanyNo: $('#company-form').find('#company-no-txt').val(),
|
|
|
TaxNo: $('#company-form').find('#tax-no-txt').val(),
|
|
|
CompanyName: $('#company-form').find('#company-name-txt').val(),
|
|
|
CompanyClass: $('#company-form').find('#company-class-select').val(),
|
|
@@ -310,6 +377,7 @@
|
|
|
Addr2: $('#company-form').find('#addr2-txt').val(),
|
|
|
BizType: $('#company-form').find('#biz-type-txt').val(),
|
|
|
DealItem: $('#company-form').find('#deal-item-txt').val(),
|
|
|
+ SellerId: Number(sellerId),
|
|
|
|
|
|
Remarks: $('#remarks-preview').html(),
|
|
|
IsDealEnd: $('#is-deal-end-check:checked').val() ?? '0',
|
|
@@ -323,12 +391,12 @@
|
|
|
} else {
|
|
|
delete parameter.UpdatedOn;
|
|
|
}
|
|
|
- // console.log(parameter)
|
|
|
+ console.log(parameter)
|
|
|
|
|
|
return parameter;
|
|
|
}
|
|
|
|
|
|
- CompanyForm.set_company_ui = function (response) {
|
|
|
+ CompanyForm.set_company_ui = async function (response) {
|
|
|
if (isEmpty(response.data) || response.data.apiStatus) {
|
|
|
$('#modal-company').modal('hide');
|
|
|
return;
|
|
@@ -338,6 +406,7 @@
|
|
|
|
|
|
$('#company-form').find('#Id').val(company.Id)
|
|
|
|
|
|
+ $('#company-form').find('#company-no-txt').val(company.CompanyNo)
|
|
|
$('#company-form').find('#tax-no-txt').val(company.TaxNo)
|
|
|
$('#company-form').find('#company-name-txt').val(company.CompanyName)
|
|
|
$('#company-form').find('#cgroup-id-select').val(company.CgroupId)
|
|
@@ -361,6 +430,9 @@
|
|
|
$('#company-form').find('#remarks-preview').html(company.Remarks)
|
|
|
$('#company-form').find('#is-deal-end-check').prop('checked', company.IsDealEnd == '1')
|
|
|
|
|
|
+ await CompanyForm.fetch_seller(company.SellerId)
|
|
|
+
|
|
|
+ $('#company-form').find('#cgroup-id-select').trigger('change')
|
|
|
$('#modal-company').modal('hide');
|
|
|
}
|
|
|
|