|
@@ -7,17 +7,7 @@
|
|
|
<div class="mb-2">
|
|
|
<label class="text-sm text-secondary mb-1">Company</label>
|
|
|
<input type="hidden" name="companyUid" value="">
|
|
|
- <input type="text"
|
|
|
- name="companyName"
|
|
|
- target-key="uid"
|
|
|
- target-field="companyUid"
|
|
|
- autocomplete="off"
|
|
|
- class="form-control form-control-sm"
|
|
|
- stag-suggest
|
|
|
- stag-suggest-ep="/company-suggest"
|
|
|
- value="{{@$company ? @$company->name : ''}}"
|
|
|
- {{@$company ? 'disabled readonly' : ''}}
|
|
|
- required>
|
|
|
+ <input type="text" name="companyName" target-key="uid" target-field="companyUid" autocomplete="off" class="form-control form-control-sm" stag-suggest stag-suggest-ep="/company-suggest" value="{{@$company ? @$company->name : ''}}" {{@$company ? 'disabled readonly' : ''}} required>
|
|
|
</div>
|
|
|
<div class="mb-2">
|
|
|
<label for="" class="control-label">Date Referred (Optional)</label>
|
|
@@ -31,17 +21,31 @@
|
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
- (function () {
|
|
|
+ function initCreateCompanyClient() {
|
|
|
+ initStagSuggest();
|
|
|
+ let parentSegment = $('body');
|
|
|
+ parentSegment.find('input[stag-suggest][target-key][target-field]')
|
|
|
+ .off('stag-suggest-selected')
|
|
|
+ .on('stag-suggest-selected', (_e, _input, _data) => {
|
|
|
+ _input = $(_input);
|
|
|
+ _input.closest('form').find('input[name="' + _input.attr('target-field') + '"]').val(_data[_input.attr('target-key')]);
|
|
|
+ });
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+@if(request()->input('popupmode'))
|
|
|
+<script>
|
|
|
+ (function() {
|
|
|
+ initCreateCompanyClient();
|
|
|
+ })();
|
|
|
+</script>
|
|
|
+@else
|
|
|
+<script>
|
|
|
+ (function() {
|
|
|
function init() {
|
|
|
- initStagSuggest();
|
|
|
- let parentSegment = $('body');
|
|
|
- parentSegment.find('input[stag-suggest][target-key][target-field]')
|
|
|
- .off('stag-suggest-selected')
|
|
|
- .on('stag-suggest-selected', (_e, _input, _data) => {
|
|
|
- _input = $(_input);
|
|
|
- _input.closest('form').find('input[name="' + _input.attr('target-field') + '"]').val(_data[_input.attr('target-key')]);
|
|
|
- });
|
|
|
+ initCreateCompanyClient();
|
|
|
}
|
|
|
addMCInitializer('create-company-client', init)
|
|
|
}).call(window);
|
|
|
-</script>
|
|
|
+</script>
|
|
|
+@endif
|