1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <span class="btn btn-inline btn-primary input_modal hidden"
- data-toggle="modal"
- data-target=".bd-input-modal-lg" data-backdrop="static" data-keyboard="false" data-controls-modal="leave_modal"></span>
- <div class="modal input fade bd-input-modal-lg"
- role="dialog"
- aria-labelledby="myLargeModalLabel"
- aria-hidden="true">
- <div class="modal-dialog modal-lg">
- <div class="modal-content">
- <div class="modal-header"><!--
- <button type="button" class="modal-close" data-dismiss="modal" aria-label="Close">
- <i class="font-icon-close-2"></i>
- </button> -->
- <h4 class="modal-title"></h4>
- </div>
- <div class="modal-body">
- <div class="modal-result"></div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-rounded btn-black" data-dismiss="modal">Cancel</button>
- <span class="btn btn-rounded btn-secondary save">Submit</span>
- </div>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- function modal_input(title,link){
- $('.input .modal-title').html(title);
- input_modal(link,callback_input);
- }
- function callback_input(){
- $('.input_modal').click();
- }
- function input_modal(link,callback){
- $('.input .modal-result').load(link,callback);
- }
- $('.save').on('click', function(e){
- e.preventDefault();
- if(check_required() == true){
- $(this).off(e);
- $(this).html('Please wait..').attr('disabled', 'disabled');
- $(this).closest('.input').find('form').submit();
- }
- });
- $(document).keypress(function(e){
- var keycode = (e.keyCode ? e.keyCode : e.which);
- if(keycode == '13'){
- e.preventDefault();
- $('.save').click();
- }
- });
- function check_required(){
- var check = 0;
- var required = 0;
- $('.input .required').each(function(){
- required = required + 1;
- if($(this).val() == null || $(this).val() == ''){
- $(this).css('border-color','#ff0000');
- }else{
- $(this).css('border-color','#d6e2e8');
- check = check + 1;
- }
- });
- if(check == required){
- return true;
- }
- }
- </script>
|